# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
293325 | REALITYNB | Sorting (IOI15_sorting) | C++14 | 2 ms | 512 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[]){
if(n==1){
p[0]=q[0]=0 ;
return 0 ;
}
if(n==2){
if(s[0]<s[1]) p[0]=0,q[0]=1 ;
else p[0]=0,q[0]=0 ;
return 0 ;
}
int pp = 2 ;
for(int i=0;i<n;i++){
swap(s[x[i]],s[y[i]]);
for(int j=0;j<n;j++){
if(s[j]==pp){
p[i] = j ;
q[i]=pp ;
break ;
}
}
pp++ ;
if(pp==n) break ;
}
if(s[0]>s[1]) p[pp-2]=q[pp-2]=0 ;
else p[pp]=0 , q[pp-2]=1 ;
return pp ;
}
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... |