Submission #94893

#TimeUsernameProblemLanguageResultExecution timeMemory
94893someone_aaSorting (IOI15_sorting)C++17
20 / 100
5 ms896 KiB
#include <bits/stdc++.h> #include "sorting.h" using namespace std; const int maxn = 110; int value[maxn], ind[maxn]; int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) { int br = 0; for(int i=0;i<N;i++) { value[i] = S[i]; ind[S[i]] = i; } for(int i=0;i<M;i++) { ind[value[X[i]]] = Y[i]; ind[value[Y[i]]] = X[i]; swap(value[X[i]], value[Y[i]]); for(int i=0;i<N;i++) { if(value[i] == i) continue; P[br] = i; Q[br] = ind[i]; ind[value[i]] = ind[i]; value[ind[i]] = value[i]; value[i] = i; ind[i] = i; br++; } } return br; }

Compilation message (stderr)

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:21:17: warning: declaration of 'i' shadows a previous local [-Wshadow]
         for(int i=0;i<N;i++) {
                 ^
sorting.cpp:15:13: note: shadowed declaration is here
     for(int i=0;i<M;i++) {
             ^
#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...