Submission #293331

#TimeUsernameProblemLanguageResultExecution timeMemory
293331REALITYNBSorting (IOI15_sorting)C++14
0 / 100
2 ms384 KiB
#include <bits/stdc++.h> using namespace std ; int findSwapPairs(int n , int s[] , int m , int x[] , int y[] , int p[] , int q[]){ /* if(n==1){ p[0]=q[0]=0 ; return 0 ; } if(n==2){ if(s[0]<s[1]) p[0]=0,q[0]=1 ; else p[0]=0,q[0]=0 ; return 0 ; }*/ int times = -1 ; int pp = 0 ; for(int i=0;i<m;i++){ swap(s[x[i]],s[y[i]]); for(int j=0;j<n;j++){ if(s[j]==pp){ p[i] = j ; q[i]=pp ; break ; } } times++ ; pp++ ; if(pp==n) break ; } /*if(s[0]>s[1]) p[pp-2]=q[pp-2]=0 ; else p[pp]=0 , q[pp-2]=1 ; */ return times ; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...