# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
135839 | AyaBenSaad | Sorting (IOI15_sorting) | C++14 | 3 ms | 504 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[]) {
int r = 0;
pair <int, int> t[N], a[N];
for (int i = 0; i < N; i++) t[i] = {S[i], i};
sort (t, t+N);
for (int i = 0; i < N; i++) {
a[t[i].second] = {t[i].second, i};
}
int id = 0;
while (id < N) {
while (a[id].second != id) {
swap (a[id], a[a[id].second]);
P[r] = id;
Q[r] = a[id].second;
r++;
}
id++;
}
return r;
}
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... |