답안 #230091

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
230091 2020-05-08T07:38:11 Z dolphingarlic Nizovi (COI14_nizovi) C++14
0 / 100
1000 ms 384 KB
#include <bits/stdc++.h>
#define FOR(i, x, y) for (int i = x; i < y; i++)
typedef long long ll;
using namespace std;

int cmp(int X, int Y) {
    cout << "cmp " << X << ' ' << Y << endl;
    cin >> X;
    return X;
}

void rev(int X, int Y) {
    cout << "reverse " << X << ' ' << Y << endl;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int A, B;
    cin >> A >> B;
    for (int A_ptr = 0, B_ptr = 0; A_ptr < A; A_ptr++) {
        if (cmp(A_ptr + B_ptr + 1, A + B_ptr + 1) == -1) continue;
        
        int l = A + B_ptr + 1, r = A + B;
        while (l != r) {
            int mid = (l + r) / 2;
            if (cmp(A_ptr + B_ptr + 1, mid) == -1) r = mid;
            else l = mid + 1;
        }

        if (A_ptr + 1 != A) rev(A_ptr + B_ptr + 1, A + B_ptr);
        if (A + B_ptr + 1 != l - 1) rev(A + B_ptr + 1, l - 1);
        rev(A_ptr + B_ptr + 1, l - 1);

        B_ptr = l - A;
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 384 KB Unexpected end of file - token expected
2 Execution timed out 3084 ms 384 KB Time limit exceeded
3 Execution timed out 3084 ms 384 KB Time limit exceeded
4 Execution timed out 3081 ms 384 KB Time limit exceeded
5 Execution timed out 3073 ms 384 KB Time limit exceeded
6 Incorrect 20 ms 384 KB Unexpected end of file - token expected
7 Execution timed out 3072 ms 384 KB Time limit exceeded
8 Incorrect 87 ms 384 KB Unexpected end of file - token expected
9 Incorrect 79 ms 384 KB Unexpected end of file - token expected
10 Incorrect 114 ms 384 KB Unexpected end of file - token expected