# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
127968 | SOIVIEONE | 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 id[2002222];
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 ++)
{
ans = i;
int flag = 0;
for(int j = 1; j < N; j ++)
{
if(S[j] < S[j - 1])
{
flag = 1;
break;
}
}
if(!flag)
break;
swap(S[id[i]], S[i]);
P[i] = id[i]; Q[i] = i;
int x = id[i];
id[S[x]] = x;
id[i] = i;
}
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... |