| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 16664 | suhgyuho_william | 정렬하기 (IOI15_sorting) | C++98 | 30 ms | 384 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "sorting.h"
#include <algorithm>
using namespace std;
int a[200002],location[200002];
int where[200002],last[200002];
int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
int i,n=N,R;
int left,right;
int cnt;
left=0;
right=M;
for(R=0;R<=M;R++){
for(i=0;i<n;i++){
a[i]=S[i];
location[a[i]]=i;
where[a[i]]=i;
}
for(i=0;i<R;i++){
location[a[X[i]]]=Y[i];
location[a[Y[i]]]=X[i];
swap(a[X[i]],a[Y[i]]);
}
cnt=-1;
for(i=0;i<n;i++) last[i]=a[i];
for(i=0;i<n;i++) a[i]=S[i];
for(i=0;i<n;i++){
if(location[i]==i) continue;
cnt++;
if(cnt>=R) break;
where[a[X[cnt]]]=Y[cnt];
where[a[Y[cnt]]]=X[cnt];
swap(a[X[cnt]],a[Y[cnt]]);
P[cnt]=where[i];
Q[cnt]=where[last[i]];
location[last[i]]=location[i];
location[i]=i;
where[a[P[cnt]]]=Q[cnt];
where[a[Q[cnt]]]=P[cnt];
swap(a[P[cnt]],a[Q[cnt]]);
}
for(i=cnt+1;i<R;i++) P[i]=Q[i]=0;
if(cnt>=R) continue;
break;
}
return R;
}
컴파일 시 표준 에러 (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... | ||||
