답안 #223822

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
223822 2020-04-16T14:05:58 Z kingfran1907 Nizovi (COI14_nizovi) C++14
0 / 100
6 ms 384 KB
#include <bits/stdc++.h>

using namespace std;
const int maxn = 1e5+10;

int a, b;

int cp(int a, int b) {
    printf("cmp %d %d\n", a, b);
    fflush(stdout);

    int x;
    scanf("%d", &x);
    return x;
}

void rev(int a, int b) {
    printf("reverse %d %d\n", a, b);
    fflush(stdout);
}

int main() {
    scanf("%d%d", &a, &b);

    int ptr = 0;
    for (int i = 1; i <= a; i++) {
        int lo = a + ptr;
        int hi = a + b;

        while (lo < hi) {
            int mid = (lo + hi + 1) / 2;
            if (cp(i + ptr, mid) == -1) lo = mid;
            else hi = mid - 1;
        }

        if (lo == a + ptr) continue;
        rev(i + ptr, lo);
        rev(i + ptr, lo - (a - i + 1));
        rev(lo - (a - i), lo);
        ptr += lo - (a - i + 1);
    }
    printf("end\n");
    fflush(stdout);
    return 0;
}

Compilation message

nizovi.cpp: In function 'int cp(int, int)':
nizovi.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &x);
     ~~~~~^~~~~~~~~~
nizovi.cpp: In function 'int main()':
nizovi.cpp:23:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &a, &b);
     ~~~~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 384 KB Incorrect
2 Incorrect 4 ms 256 KB Incorrect
3 Incorrect 5 ms 256 KB Incorrect
4 Incorrect 5 ms 256 KB Incorrect
5 Incorrect 5 ms 384 KB Incorrect
6 Incorrect 5 ms 384 KB Incorrect
7 Incorrect 5 ms 256 KB Incorrect
8 Incorrect 6 ms 256 KB Incorrect
9 Incorrect 5 ms 256 KB Incorrect
10 Incorrect 5 ms 256 KB Incorrect