QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#707674 | #6434. Paimon Sorting | sw7777# | WA | 0ms | 3612kb | C++20 | 862b | 2024-11-03 17:00:22 | 2024-11-03 17:00:22 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N=1e6+10;
#define int long long
#define endl "\n"
int a[N];
signed main (){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t;cin>>t;
while(t--){
int n;cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i];
}
int de=0;
int ans=0;
for(int i=1;i<=n;i++){
if(i==1) cout<<ans<<" ";
else{
if(a[i]==a[i-1]){
ans+=de;
cout<<ans<<" ";
}else if(a[i]<a[i-1]){
de++;
ans+=de;
cout<<ans<<" ";
}else{
ans+=2;
cout<<ans<<" ";
}
}
}
cout<<endl;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3612kb
input:
3 5 2 3 2 1 5 3 1 2 3 1 1
output:
0 2 3 5 7 0 2 4 0
result:
wrong answer 1st lines differ - expected: '0 2 3 5 7', found: '0 2 3 5 7 '