比赛 |
2022级DP专题练习赛7 |
评测结果 |
WWWAAATTTTTTTTTTTTTT |
题目名称 |
数列 |
最终得分 |
15 |
用户昵称 |
Skloud |
运行时间 |
14.876 s |
代码语言 |
C++ |
内存使用 |
6.18 MiB |
提交时间 |
2023-02-27 20:08:25 |
显示代码纯文本
#include<cstdio>
#include<algorithm>
#include<deque>
#include<cstring>
using namespace std;
int n,a[200005],s,y;
deque <int> q;
void dfs(int x)
{
if(x==n+1)
{
int sum=0,ans=0,num=0,num2=0;
deque <int> p;
p=q;
while(p.size())
{
num2=p.front();
p.pop_front();
if(num2>num) sum++;
else
{
if(sum==s) y++;
else if(sum>s) s=sum,y=1;
ans=max(sum,ans),sum=1;
}
num=num2;
}
ans=max(ans,sum);
if(ans==s) y++;
else if(ans>s) s=ans,y=1;
return;
}
q.push_front(a[x]);
dfs(x+1);
q.pop_front();
q.push_back(a[x]);
dfs(x+1);
q.pop_back();
}
int main()
{
freopen("lisshulie.in","r",stdin);
freopen("lisshulie.out","w",stdout);
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
scanf("%d",a+i);
}
dfs(1);
printf("%d %d\n",s,y/2);
return 0;
}