Submission #427977

#TimeUsernameProblemLanguageResultExecution timeMemory
427977haxormanSorting (IOI15_sorting)C++14
20 / 100
123 ms360 KiB
#include "sorting.h" #include "bits/stdc++.h" using namespace std; const int mxN = 2e5 + 7; int n, m, arr[mxN]; int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) { n = N, m = M; for (int i = 0; i < n; ++i) { arr[i] = S[i]; } sort(S, S + n); int R = 0, ind = 0; for (int iter = 1; iter <= 50; ++iter) { for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { if (arr[j] == S[i] && i != j) { swap(arr[j], arr[i]); P[ind] = j, Q[ind] = i; ++R; ++ind; break; } } } } if (arr[0] != 0) { P[ind] = 0, Q[ind] = 1; ++R; ++ind; } return R; }

Compilation message (stderr)

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