# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
463545 | kilikuma | Xor Sort (eJOI20_xorsort) | C++14 | 1 ms | 204 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>
using namespace std;
int main() {
int A[1005];
int N; cin >>N;
int id; cin >> id;
for (int i=1;i<=N;i++) cin >> A[i];
vector<int> res;
for (int i=1; i<= N; i++) {
int b = i;
while((b<N) && (A[b] > A[b+1])) {
res.push_back(b);
res.push_back(b+1);
res.push_back(b+1);
res.push_back(b);
res.push_back(b);
res.push_back(b+1);
swap(A[b], A[b+1]);
b ++;
}
}
printf("%d\n", res.size()/2);
for (int i=0;i<res.size(); i+=2) {
printf("%d %d\n", res[i], res[i+1]);
}
}
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... |