QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#707674#6434. Paimon Sortingsw7777#WA 0ms3612kbC++20862b2024-11-03 17:00:222024-11-03 17:00:22

Judging History

你现在查看的是最新测评结果

  • [2024-11-03 17:00:22]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3612kb
  • [2024-11-03 17:00:22]
  • 提交

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 '