General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
230491625 Practice:
Sparkle_Twilight
1744F - 21 C++17 (GCC 7-32) Accepted 296 ms 1572 KB 2023-10-30 15:06:43 2023-10-30 15:06:43
→ Source
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
long long T,p[N],n,l,r,re,me,i,x,L;
int main(){
for(cin>>T;T--;){
cin>>n;
for(i=1;i<=n;i++)cin>>x,p[x]=i;l=r=p[0],re=1,me=0;
for(L=2;L<=n;L++)me=(L-1)/2,l=min({l,p[me],n+1-L}),r=max({r,p[me],L}),re+=max(0ll,L-r+l);
cout<<re<<'\n';
}
}
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details