QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#697244 | #6434. Paimon Sorting | fsy_juruo# | WA | 0ms | 3764kb | C++17 | 1.0kb | 2024-11-01 12:24:30 | 2024-11-01 12:24:32 |
Judging History
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;
}
Details
Tip: Click on the bar to expand more detailed information
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 '