# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
421259 | Pbezz | 정렬하기 (IOI15_sorting) | C++14 | 0 ms | 0 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.
for(i=2;i<N;i++){//find i, send it to ith position
for(k=0;k<N;k++){
if(S[k]==i)break;
}
if(k!=i){
P[R]=k;
Q[R]=i;
R++;
swap(S[k],S[i]);
ok=true;
for(j=0;j<N;j++){
if(S[j]!=j)ok=false;
}
if(ok){
return R;
}
swap(S[0],S[1]);
}
}
if(S[0]==1){
P[R]=0;
Q[R]=0;
R++;
}