# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
67943 | funcsr | Sorting (IOI15_sorting) | C++17 | 463 ms | 13328 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 <iostream>
#include <algorithm>
#include <vector>
#include <cassert>
using namespace std;
#define rep(i, n) for (int i=0; i<(n); i++)
#define pb push_back
#define _1 first
#define _2 second
int S[200000];
bool used[200000];
vector<pair<int, int> > f(int R, int N, int SS[], int X[], int Y[]) {
rep(i, N) S[i] = SS[i];
rep(i, R) swap(S[X[i]], S[Y[i]]);
rep(i, N) used[i] = false;
vector<pair<int, int> > ret;
rep(s, N) if (!used[s]) {
vector<int> seq;
int v = s;
used[v] = true;
seq.pb(v);
while (true) {
v = S[v];
if (v == s) break;
assert(!used[v]);
seq.pb(v);
used[v] = true;
}
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... |