Submission #921738

#TimeUsernameProblemLanguageResultExecution timeMemory
921738coding_snorlaxSorting (IOI15_sorting)C++14
0 / 100
3 ms348 KiB
#include "sorting.h" #include<bits/stdc++.h> using namespace std; int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) { for(int i=2;i<N;i++){ int tmp = S[X[i]]; S[X[i]]=S[Y[i]]; S[Y[i]]=tmp; for(int j=0;j<N;j++){ if(S[j]==i){ P[i]=j; Q[i]=i; S[j]=S[i]; S[i]=i; break; } } // check already_sorted int flag = 1; for(int j=0;j<N;j++){ if(S[j]!=j) flag =0; } if(flag){ return i-1; } } P[N-2]=0;Q[N-2]=1; return N-1; }

Compilation message (stderr)

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:4:39: warning: unused parameter 'M' [-Wunused-parameter]
    4 | 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...