| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 385047 | qpwoeirut | 정렬하기 (IOI15_sorting) | C++17 | 2 ms | 620 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "sorting.h"
#include <algorithm>
#include <cassert>
#include <iostream>
using namespace std;
#define val first
#define idx second
typedef pair<int,int> pii;
const int MN = 200005;
pii A[MN];
int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
    if (N == 1) return 0;
    int K = 0;
    if (X[0] == 0 && Y[0] == 0) {
        for (int i=0; i<N; ++i) {
            int idx = min_element(S+i, S+N) - S;
            if (idx == i) continue;
            P[K] = i;
            Q[K] = idx;
            ++K;
            swap(S[i], S[idx]);
        }
    } else if (X[0] == 0 && Y[0] == 1) {
        assert(0);
        for (int i=2; i<N; ++i) {
            int idx = min_element(S+i, S+N) - S;
            if (idx == i) continue;
            swap(S[0], S[1]);
            P[K] = i;
            Q[K] = idx;
            ++K;
            swap(S[i], S[idx]);
        }
        while (N > 2 && S[0] + S[1] > 1) {
            swap(S[0], S[1]);
            if (S[0] < S[1]) {
                P[K] = 1;
                swap(S[1], S[2]);
            } else {
                P[K] = 0;
                swap(S[0], S[2]);
            }
            Q[K] = 2;
            ++K;
            for (int i=2; i+1<N; ++i) {
                if (S[i] > S[i+1]) {
                    swap(S[0], S[1]);
                    swap(S[i], S[i+1]);
                    P[K] = i;
                    Q[K] = i+1;
                    ++K;
                } else break;
            }
        }
        if (S[0] == 1) {
            assert(S[1] == 0);
            P[K] = 0;
            Q[K] = 0;
            ++K;
        }
    } else assert(0);
    assert(is_sorted(S, S+N));
    assert(K <= M);
    return K;
}
컴파일 시 표준 에러 (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... | ||||
