# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
464892 | 2021-08-14T11:42:58 Z | bigo | Xor Sort (eJOI20_xorsort) | C++14 | 1000 ms | 204 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long typedef pair<ll, ll> pii; int main() { int s, n; cin >> n >> s; vector<ll>vec(n); for (int i = 0; i < n; i++) cin >> vec[i]; vector<pii>vec1; vec1.push_back({ 0, 1 }); for (int i = 1; i < n - 1; i++) { vec1.push_back({ i,i - 1 }); vec1.push_back({ i,i + 1 }); } vec1.push_back({ n - 1,n - 2 }); bool fl = true; for (int i = 0; i < n-1; i++) { if (vec[i] >= vec[i + 1]) { fl = false; break; } } if (!fl) { int pla; while (next_permutation(vec1.begin(), vec1.end())) { vector<ll>tmp = vec; bool fl2=false; for (int i = 0; i < vec1.size(); i++) { tmp[vec1[i].first] = (tmp[vec1[i].first] ^ tmp[vec1[i].second]); bool fl1 = true; for (int j = 0; j < n - 1; j++) { if (tmp[j] >= tmp[j + 1]) { fl1 = false; break; } } if (fl1) { pla = i; fl2 = true; break; } } if (fl2) break; } cout << pla + 1 << endl; for (int i = 0; i <= pla; i++) cout << vec1[i].first + 1 << " " << vec1[i].second + 1 << endl; } else cout << 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Execution timed out | 1093 ms | 204 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Execution timed out | 1093 ms | 204 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Execution timed out | 1086 ms | 204 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |