QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#777523#9792. Ogre Sortucup-team3099#WA 1ms3828kbC++23570b2024-11-24 02:52:412024-11-24 02:52:44

Judging History

This is the latest submission verdict.

  • [2024-11-24 02:52:44]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3828kb
  • [2024-11-24 02:52:41]
  • Submitted

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