# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
422706 | vanic | 정렬하기 (IOI15_sorting) | C++14 | 1 ms | 332 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "sorting.h"
#include <algorithm>
using namespace std;
const int maxn=2e5+5;
int pos[maxn];
int findSwapPairs(int n, int l[], int m, int x[], int y[], int p[], int q[]){
for(int i=0; i<n; i++){
pos[l[i]]=i;
}
int br=2;
int dr;
for(int i=0; i<n-2; i++){
swap(l[x[i]], l[y[i]]);
swap(pos[l[x[i]]], pos[l[y[i]]]);
p[i]=pos[br];
q[i]=br;
dr=l[br];
swap(l[pos[dr]], l[pos[br]]);
swap(pos[br], pos[dr]);
br++;
}
int sol;
if(l[0]==0){
sol=n-2;
}
else{
sol=n-1;
swap(l[x[n-2]], l[y[n-2]]);
swap(pos[l[x[n-2]]], pos[l[y[n-2]]]);
p[n-2]=0;
if(l[0]!=0){
q[n-2]=1;
}
else{
q[n-2]=0;
}
}
return sol;
}
컴파일 시 표준 에러 (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... |