# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
126179 | SOIVIEONE | Sorting (IOI15_sorting) | C++14 | 4 ms | 376 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 id[2222222];
int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
for(int i = 0; i < N; i ++)
id[S[i]] = i;
int ans = 0;
for(int i = 0; i < N; i ++)
{
int flag = 0;
for(int j = 1; j < N; j ++)
if(S[j] < S[j - 1])
flag = 1;
if(!flag)
break;
swap(S[id[i]], S[i]);
P[i] = id[i]; Q[i] = i;
id[S[id[i]]] = id[i];
id[i] = i;
ans = i+1;
}
return ans;
}
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... |