# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
94894 | someone_aa | Sorting (IOI15_sorting) | C++17 | 4 ms | 668 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 <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=N-1;i>=0;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++;
break;
}
}
return br;
}
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... |