QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#697244#6434. Paimon Sortingfsy_juruo#WA 0ms3764kbC++171.0kb2024-11-01 12:24:302024-11-01 12:24:32

Judging History

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

  • [2024-11-01 12:24:32]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3764kb
  • [2024-11-01 12:24:30]
  • 提交

answer

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define LL long long
using namespace std;
using namespace __gnu_pbds;
typedef pair<long long,int> pii;
tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> T;
const int maxN=1e5+100;
int t, n;
LL a[maxN];

int main() {
    scanf("%d",&t);
    while(t--) {
        T.clear();
        scanf("%d",&n);
        LL ans = 0;
        for(int i = 1; i <= n; i++) {
            scanf("%lld",a+i);
        }
        T.insert(make_pair(a[1],1));
        printf("0 ");
        for(int i=2;i<=n;i++){
            LL maxx=(--T.end())->first;
            if(a[i]>maxx){
                ans+=2;
                T.insert(make_pair(a[i],i));
            }
            else{
                LL rk=T.order_of_key(make_pair(a[i],n));
                ans+=T.size()-rk;
            }
            if(i!=n)printf("%lld ",ans);
            else printf("%lld",ans);
        }
        puts("");
    }
    return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3764kb

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 3rd lines differ - expected: '0', found: '0 '