# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
795507 | Cauchico | Sorting (IOI15_sorting) | C++14 | 1 ms | 340 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;
int swaps = m;
for (int i=0;i<m;i++) {
P[i] = Q[i] = 0;
}
for (int i=0;i<n;i++) {
bool flag = false;
for (int i=1;i<n;i++) {
if (S[i] < S[i-1]) flag = true;
}
if (flag) {
swaps = i;
break;
}
for (int j=0;j<n;j++) {
if (S[j] == i) {
swap(S[j], S[i]);
P[i] = i;
Q[i] = j;
}
}
}
swaps = n;
if (Y[0] == 1 and m&1) {
Q[m-1] = 1;
swaps++;
}
return swaps;
}
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... |