답안 #478165

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
478165 2021-10-06T06:26:22 Z FatihSolak Nizovi (COI14_nizovi) C++17
0 / 100
12 ms 200 KB
#include <bits/stdc++.h>
using namespace std;
int a,b;
int ask(int x,int y){
    cout << "cmp " << x << " " << y << endl;
    int ret;
    cin >> ret;
    return ret;
}
int tot = 0;
void rev(int l,int r){
    if(r >= l)return;
    tot += r - l +1;
    while(!(tot <= 3000000));
    while(!(r <= a+b && l > 0 && l <= r));
    cout << "reverse " << l << " " << r << endl;
}
int main(){
    cin >> a >> b;
    int pos = 1;
    for(int i=1;i<=a && pos < a  + b;i++){
        int l = pos + a - i + 1, r = a+b;
        int cnt = -l;
        if(ask(pos,l) != 1){
            pos++;
            continue;
        }
        while(l < r){
            int m = (l + r + 1)/2;
            if(ask(m,pos) == 1){
                r = m-1;
            }
            else l = m;
        }
        cnt += l;
        rev(pos,l);
        rev(pos,pos+cnt);
        rev(pos+cnt+1,l);
        pos += cnt + 2;
    }
    cout << "end" << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 200 KB Incorrect
2 Incorrect 1 ms 200 KB Incorrect
3 Incorrect 1 ms 200 KB Incorrect
4 Incorrect 5 ms 200 KB Incorrect
5 Incorrect 8 ms 200 KB Incorrect
6 Incorrect 8 ms 200 KB Incorrect
7 Incorrect 11 ms 200 KB Incorrect
8 Incorrect 11 ms 200 KB Incorrect
9 Incorrect 12 ms 200 KB Incorrect
10 Incorrect 8 ms 200 KB Incorrect