Submission #127968

#TimeUsernameProblemLanguageResultExecution timeMemory
127968SOIVIEONESorting (IOI15_sorting)C++14
0 / 100
3 ms504 KiB
#include "sorting.h" #include <bits/stdc++.h> using namespace std; int id[2002222]; int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) { for(int i = 0; i < N; i ++) id[S[i]] = i; int ans = 0; for(int i = 0; i < N; i ++) { ans = i; int flag = 0; for(int j = 1; j < N; j ++) { if(S[j] < S[j - 1]) { flag = 1; break; } } if(!flag) break; swap(S[id[i]], S[i]); P[i] = id[i]; Q[i] = i; int x = id[i]; id[S[x]] = x; id[i] = i; } return ans; }

Compilation message (stderr)

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:6:39: warning: unused parameter 'M' [-Wunused-parameter]
 int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) 
                                       ^
sorting.cpp:6:48: warning: unused parameter 'X' [-Wunused-parameter]
 int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) 
                                                ^
sorting.cpp:6:57: warning: unused parameter 'Y' [-Wunused-parameter]
 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...