# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
432565 | daniel920712 | 정렬하기 (IOI15_sorting) | C++14 | 4 ms | 332 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>
using namespace std;
int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[])
{
int i,j,now=0,ok;
for(i=N-1;i>=0;i--)
{
ok=1;
for(j=0;j<N;j++) if(S[j]!=j) ok=0;
if(ok) break;
swap(S[X[now]],S[Y[now]]);
for(j=0;j<N;j++)
{
if(S[j]==i)
{
if(i!=j)
{
P[now]=i;
Q[now]=j;
}
else
{
P[now]=0;
Q[now]=1;
}
swap(S[P[now]],S[Q[now]]);
now++;
break;
}
}
}
return now;
}
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... |