QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#773569 | #9792. Ogre Sort | ucup-team2279# | WA | 1ms | 5708kb | C++20 | 504b | 2024-11-23 09:24:33 | 2024-11-23 09:24:38 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N=3e5+5;
int n,j=1,a[N],b[N];
vector<array<int,2>> p;
long long s;
int main(){
cin.tie(0)->sync_with_stdio(0);
cin>>n;
for(int i=1;i<=n;i++) cin>>a[i];
for(int i=1;i<=n;i++){
for(;j<=n&&a[j]<i;j++) p.push_back({i-1,b[a[j]]});
if(i==a[j]) j++;
else s+=b[i]=j;
}
for(;j<=n;j++) p.push_back({n,b[a[j]]});
cout<<s<<" "<<p.size()<<"\n";
reverse(begin(p),end(p));
for(auto&x:p) cout<<x[0]<<" "<<x[1]<<"\n";
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3676kb
input:
4 1 2 4 3
output:
3 1 4 3
result:
ok Participant's output is correct
Test #2:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
5 2 4 1 3 5
output:
3 2 4 2 4 1
result:
ok Participant's output is correct
Test #3:
score: 0
Accepted
time: 0ms
memory: 3740kb
input:
3 1 2 3
output:
0 0
result:
ok Participant's output is correct
Test #4:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
4 1 2 4 3
output:
3 1 4 3
result:
ok Participant's output is correct
Test #5:
score: 0
Accepted
time: 1ms
memory: 5708kb
input:
5 2 4 1 3 5
output:
3 2 4 2 4 1
result:
ok Participant's output is correct
Test #6:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
3 1 2 3
output:
0 0
result:
ok Participant's output is correct
Test #7:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
1 1
output:
0 0
result:
ok Participant's output is correct
Test #8:
score: -100
Wrong Answer
time: 0ms
memory: 3648kb
input:
5 5 3 4 1 2
output:
4 4 5 1 5 1 5 1 5 1
result:
wrong answer participant's moves don't sort the array