# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
707925 | josanneo22 | Xor Sort (eJOI20_xorsort) | C++17 | 0 ms | 212 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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]);
}
}
}
for (int i = 0; i < ans.size(); i++) {
cout << ans[i].first+1 << ' ' << ans[i].second+1 << '\n';
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |