# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
794910 | Username4132 | 정렬하기 (IOI15_sorting) | C++14 | 27 ms | 3412 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "sorting.h"
#include<iostream>
#include<algorithm>
using namespace std;
#define forn(i, n) for(int i=0; i<(int)n; ++i)
#define forsn(i, s, n) for(int i=s; i<(int)n; ++i)
const int MAXN = 610;
int n, cou, ans, arr[MAXN][MAXN];
int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
n=N;
forn(i, n) arr[0][i]=S[i];
forn(i, n-1){
forn(j, n) arr[i+1][j]=arr[i][j];
swap(arr[i+1][X[i]], arr[i+1][Y[i]]);
}
forn(i, n-1){
int num = arr[n-1][i];
forsn(j, i+1, n){
int x = find(arr[j], arr[j]+n, num) - arr[j];
int y = find(arr[j], arr[j]+n, i) - arr[j];
swap(arr[j][x], arr[j][y]);
if(j==i+1) P[cou]=x, Q[cou]=y, ++cou;
}
}
while(true){
bool flag=true;
forn(i, n) flag&=(S[i]==i);
if(flag) break;
swap(S[X[ans]], S[Y[ans]]);
swap(S[P[ans]], S[Q[ans]]);
++ans;
}
return ans;
}
컴파일 시 표준 에러 (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... |