QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#576814 | #9313. Make Max | eden369 | WA | 1ms | 5708kb | C++14 | 795b | 2024-09-19 22:37:13 | 2024-09-19 22:37:14 |
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 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]=l[i-1]+1;
}
else l[i]=0;
}
for(int i=n-1;i>=1;i--)
{
if(a[i+1]<a[i])
{
r[i]=r[i+1]+1;
}
else r[i]=0;
}
int an=0;
for(int i=1;i<=n;i++)
{
an+=r[i]+l[i];
}
cout<<an<<endl;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 5708kb
input:
4 2 1 2 2 2 2 7 1 1 1 2 2 2 2 3 1 2 3
output:
1 0 1 3
result:
wrong answer 3rd numbers differ - expected: '3', found: '1'