Submission #502889

#TimeUsernameProblemLanguageResultExecution timeMemory
502889uncriptedXor Sort (eJOI20_xorsort)C++11
25 / 100
44 ms1356 KiB
#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)

xorsort.cpp: In function 'int main()':
xorsort.cpp:18:7: warning: unused variable 'j' [-Wunused-variable]
   18 |   int j=0;
      |       ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...