Submission #117755

#TimeUsernameProblemLanguageResultExecution timeMemory
117755zubecSorting (IOI15_sorting)C++14
0 / 100
2 ms384 KiB
#include "sorting.h" #include <bits/stdc++.h> using namespace std; int pos[200100]; int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) { int ans = 0; for (int i = 0; i < N; i++){ pos[S[i]] = i; } for (int i = 0; i < N; i++){ if (S[i] != i){ int x = pos[i]; /*pos[S[x]] = x; pos[i] = i;*/ swap(pos[i], pos[S[x]]); swap(S[i], S[x]); P[ans] = i; S[ans] = x; ++ans; } } return ans; }

Compilation message (stderr)

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