# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
502889 | uncripted | Xor Sort (eJOI20_xorsort) | C++11 | 44 ms | 1356 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 pas[40000][3];
int main(){
int s;
int n;
cin>>n;
cin>>s;
int k=0;
int a[n+1];
for(int i=1; i<=n; i++){
cin>>a[i];
}
int j=0;
for(int i=0; i<n-1; i++){
for(int j=n; j>i+1; j--){
if(j==1){
continue;
}
if(a[j]>=a[j-1]){
continue;
}
pas[k+1][1]=j;
pas[k+1][2]=j-1;
pas[k+2][1]=j-1;
pas[k+2][2]=j;
pas[k+3][1]=j;
pas[k+3][2]=j-1;
k+=3;
// cout<<a[j]<<"x "<<j-1<<endl;
swap(a[j], a[j-1]);
}
}
cout<<k<<endl;
for(int i=1; i<=k; i++){
cout<<pas[i][1]<<" "<<pas[i][2]<<endl;
}
}
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... |