# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
432577 | daniel920712 | Sorting (IOI15_sorting) | C++14 | 3 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>
#include <stdio.h>
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;
if(S[i]==i) continue;
if(X[now]!=Y[now]) swap(S[X[now]],S[Y[now]]);
for(j=0;j<N;j++)
{
if(S[j]==i)
{
P[now]=i;
Q[now]=j;
swap(S[P[now]],S[Q[now]]);
now++;
break;
}
}
}
//for(j=0;j<N;j++) printf("%d ",S[j]);
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... |