# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
795543 | Cauchico | Sorting (IOI15_sorting) | C++14 | 9 ms | 596 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 n = N, m = M;
for (int i=n;i<m;i++) {
P[i] = Q[i] = 0;
}
vector<int> p,q;
bool toswap = true;
for (int i=2;i<n;i++) {
if (Y[0] == 1 and toswap) {
swap(S[0],S[1]);
toswap = false;
}
for (int j=0;j<n;j++) {
if (S[j] == i and i != j) {
swap(S[j], S[i]);
p.push_back(i);
q.push_back(j);
toswap = true;
}
}
}
if (S[0] != 0) {
p.push_back(0);
if (Y[0] == 1 and toswap) q.push_back(0);
else q.push_back(1);
} else if (Y[0] == 1 and toswap == false) {
p.push_back(0);
q.push_back(0);
}
for (int i=0;i<p.size();i++) {
P[i] = p[i];
Q[i] = q[i];
}
return p.size();
}
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... |