Submission #293325

#TimeUsernameProblemLanguageResultExecution timeMemory
293325REALITYNBSorting (IOI15_sorting)C++14
0 / 100
2 ms512 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 pp = 2 ; for(int i=0;i<n;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 ; } } 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 pp ; }

Compilation message (stderr)

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:3:41: warning: unused parameter 'm' [-Wunused-parameter]
    3 | int findSwapPairs(int n , int s[] , int m , int x[] , int y[] , int p[] , int q[]){
      |                                     ~~~~^
#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...