# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
620960 | Hazem | Sorting (IOI15_sorting) | C++14 | 6 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 <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;
int cur = 0;
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
if(i==j)
continue;
else
if(S[j]==i){
P[cur] = i;
Q[cur] = j;
cur++;
swap(S[i],S[j]);
}
bool q = 1;
if(cur&1)
swap(S[0],S[1]);
for(int i=0;i<n;i++)
q &= S[i]==i;
if(!q)
P[cur] = 0,Q[cur] = 0,cur++;
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... |