QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#576830 | #9313. Make Max | eden369 | WA | 91ms | 11288kb | C++14 | 1.0kb | 2024-09-19 22:47:53 | 2024-09-19 22:47:53 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int n,m;
const int N=1e6+10;
int a[N];
int l[N];
int r[N];
int ll[N],rr[N];
int main(){
int t;
cin>>t;
while(t--)
{
int ans=0;
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i];
}
for(int i=2;i<=n;i++)
{
if(a[i]>a[i-1])
{
l[i]=ll[i-1]+1;
}
else
{
l[i]=0;
}
if(a[i]>=a[i-1])
{
ll[i]=ll[i-1]+1;
}
}
for(int i=n-1;i>=1;i--)
{
if(a[i+1]<a[i])
{
r[i]=rr[i+1]+1;
}
else r[i]=0;
if(a[i+1]<=a[i])
{
rr[i]=rr[i+1]+1;
}
}
int an=0;
for(int i=1;i<=n;i++)
{
an+=r[i]+l[i];
}
cout<<an<<endl;
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 9840kb
input:
4 2 1 2 2 2 2 7 1 1 1 2 2 2 2 3 1 2 3
output:
1 0 3 3
result:
ok 4 number(s): "1 0 3 3"
Test #2:
score: -100
Wrong Answer
time: 91ms
memory: 11288kb
input:
2 198018 875421126 585870339 471894633 383529988 625397685 944061047 704695631 105113224 459022561 760848605 980735314 847376362 980571959 329939331 644635272 326439858 752879510 837384394 175179068 182094523 397239381 1199016 185143405 279638454 252374970 822030887 860312140 137248166 993229443 164...
output:
284239 410592
result:
wrong answer 1st numbers differ - expected: '4084978', found: '284239'