# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
775019 | 2023-07-06T06:52:29 Z | daoquanglinh2007 | Xor Sort (eJOI20_xorsort) | C++17 | 99 ms | 12408 KB |
#include <bits/stdc++.h> using namespace std; #define pii pair <int, int> #define fi first #define se second #define mp make_pair const int NM = 1000; int N, S, a[NM+5]; vector <pii> ans; void op(int i, int j){ ans.push_back(mp(i, j)); a[i] ^= a[j]; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> N >> S; for (int i = 1; i <= N; i++) cin >> a[i]; while (true){ bool ok = 1; for (int i = 1; i < N; i++) if (a[i] > a[i+1]){ ok = 0; op(i+1, i); op(i, i+1); op(i+1, i); } if (ok) break; } cout << ans.size() << '\n'; for (int i = 0; i < ans.size(); i++) cout << ans[i].fi << ' ' << ans[i].se << '\n'; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 2 ms | 580 KB | Output is correct |
5 | Correct | 3 ms | 600 KB | Output is correct |
6 | Correct | 3 ms | 600 KB | Output is correct |
7 | Correct | 2 ms | 600 KB | Output is correct |
8 | Correct | 3 ms | 600 KB | Output is correct |
9 | Correct | 3 ms | 728 KB | Output is correct |
10 | Correct | 3 ms | 728 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 4 ms | 984 KB | Output is correct |
13 | Correct | 5 ms | 856 KB | Output is correct |
14 | Correct | 5 ms | 984 KB | Output is correct |
15 | Correct | 5 ms | 984 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 2 ms | 580 KB | Output is correct |
5 | Correct | 3 ms | 600 KB | Output is correct |
6 | Correct | 3 ms | 600 KB | Output is correct |
7 | Correct | 2 ms | 600 KB | Output is correct |
8 | Correct | 3 ms | 600 KB | Output is correct |
9 | Correct | 3 ms | 728 KB | Output is correct |
10 | Correct | 3 ms | 728 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 4 ms | 984 KB | Output is correct |
13 | Correct | 5 ms | 856 KB | Output is correct |
14 | Correct | 5 ms | 984 KB | Output is correct |
15 | Correct | 5 ms | 984 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 3 ms | 600 KB | Output is correct |
18 | Correct | 4 ms | 856 KB | Output is correct |
19 | Correct | 4 ms | 836 KB | Output is correct |
20 | Correct | 4 ms | 856 KB | Output is correct |
21 | Correct | 4 ms | 840 KB | Output is correct |
22 | Correct | 4 ms | 888 KB | Output is correct |
23 | Correct | 4 ms | 856 KB | Output is correct |
24 | Correct | 4 ms | 856 KB | Output is correct |
25 | Correct | 6 ms | 856 KB | Output is correct |
26 | Incorrect | 8 ms | 1200 KB | Integer 59568 violates the range [0, 40000] |
27 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 320 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 4 ms | 856 KB | Output is correct |
5 | Incorrect | 99 ms | 12408 KB | Integer 764742 violates the range [0, 40000] |
6 | Halted | 0 ms | 0 KB | - |