Submission #830611

#TimeUsernameProblemLanguageResultExecution timeMemory
830611ShithilaSorting (IOI15_sorting)C++14
0 / 100
1 ms340 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[]) { int pos[N]; int ind=0; for(int i=0;i<N;i++) pos[s[i]]=i; for(int i=0;i<N;i++) { //ind++; if(i==s[i]) continue; P[ind]=i; Q[ind]=pos[i]; int x=pos[i]; pos[i]=i; pos[s[i]]=x; s[x]=s[i]; s[i]=i; ind++; int k=s[0]; pos[s[0]]=1; pos[s[1]]=0; s[0]=s[1]; s[1]=k; } if(s[0]==1) { ind++; P[ind]=0; Q[ind]=1; } return ind; }

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[]) {
      |                                   ~~~~^
sorting.cpp:4:46: warning: unused parameter 'X' [-Wunused-parameter]
    4 | int findSwapPairs(int N, int s[], int M, int X[], int Y[], int P[], int Q[]) {
      |                                          ~~~~^~~
sorting.cpp:4:55: warning: unused parameter 'Y' [-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...