QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#777523 | #9792. Ogre Sort | ucup-team3099# | WA | 1ms | 3828kb | C++23 | 570b | 2024-11-24 02:52:41 | 2024-11-24 02:52:44 |
Judging History
answer
#include <bits/stdc++.h>
// #include <b
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n; cin >> n;
vector<int> a(n), pos(n);
for (int i = 0; i < n; i++) {
cin >> a[i]; a[i]--;
pos[a[i]] = i;
}
int cur = n - 1;
for (int i = n - 1; i >= 0; i--) {
if (a[i] == cur) {
cur--;
}
}
cout << cur + 1 << " " << cur + 1 << '\n';
for (int i = cur, cnt = 1; i >= 0; i--, cnt++) {
cout << pos[i] + cnt << " 1\n";
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3544kb
input:
4 1 2 4 3
output:
3 3 4 1 3 1 3 1
result:
ok Participant's output is correct
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3828kb
input:
5 2 4 1 3 5
output:
3 3 4 1 2 1 5 1
result:
wrong answer participant's moves don't sort the array