# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
707926 | 2023-03-10T13:58:16 Z | josanneo22 | Xor Sort (eJOI20_xorsort) | C++17 | 0 ms | 212 KB |
#include<bits/stdc++.h> #include<iostream> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, s; cin >> n >> s; vector<int> a(n); for (auto& x : a) cin >> x; vector<pair<int, int>> ans; if (s == 1) { for (int i = 1; i < n; i++) { if (a[i] < a[i - 1]) { ans.push_back(make_pair(i,i-1)); ans.push_back(make_pair(i-1, i)); ans.push_back(make_pair(i, i - 1)); swap(a[i], a[i - 1]); } } } cout << ans.size() << '\n'; for (int i = 0; i < ans.size(); i++) { cout << ans[i].first+1 << ' ' << ans[i].second+1 << '\n'; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Not sorted |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Not sorted |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Not sorted |
2 | Halted | 0 ms | 0 KB | - |