# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
160543 | FiloSanza | Sorting (IOI15_sorting) | C++14 | 8 ms | 376 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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[]) {
swap(S[X[0]], S[Y[0]]);
int idx1 = -1;
int idx0 = -1;
int cont = 0;
for(int i=0; i<N; i++){
int idx = min_element(S+i, S+N) - S;
//if(idx == i) continue;
swap(S[i], S[idx]);
P[cont] = i;
Q[cont++] = idx;
swap(S[X[i]], S[Y[i]]);
}
if(S[0] > S[1]){
P[cont] = 0;
Q[cont++] = 1;
}
return cont;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |