# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
743780 | Abrar_Al_Samit | Sorting (IOI15_sorting) | C++17 | 1 ms | 340 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "sorting.h"
using namespace std;
int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
if(N<3) {
if(N==1) return 0;
//swap(S[X[0]], S[Y[0]]);
if(S[0]<S[1]) {
return 0;
} else {
P[0] = 0, Q[0] = 1;
return 1;
}
}
int at[N];
for(int i=0; i<N; ++i) {
at[S[i]] = i;
}
for(int i=0; i<N-1; ++i) {
// swap(S[X[i]], S[Y[i]]);
// at[S[0]] = 0;
// at[S[1]] = 1;
int pos = N-i-1;
if(at[pos]==pos) {
P[i] = Q[i] = 0;
} else {
P[i] = at[pos], Q[i] = pos;
at[S[pos]] = at[pos];
swap(S[pos], S[at[pos]]);
at[pos] = pos;
}
// if(i==N-3) {
// if(at[0]==0) return i+1;
// else {
// if(Y[i]) {
// P[i+1] = Q[i+1] = 0;
// } else {
// P[i+1] = 0, Q[i+1] = 1;
// }
// return i+2;
// }
// }
}
return N-1;
}
컴파일 시 표준 에러 (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... |