Submission #478105

# Submission time Handle Problem Language Result Execution time Memory
478105 2021-10-05T15:09:20 Z FatihSolak Nizovi (COI14_nizovi) C++17
0 / 100
1 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;
}
void revers(int l,int r){
    assert(r <= a+b && l > 0 && l <= r);
    cout << "reverse " << l << " " << r << endl;
}
int main(){
    cin >> a >> b;
    int pos = 1;
    cout << "reverse" << -1 << " " << -2 << endl;
    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;
        revers(pos,l);
        revers(pos,pos+cnt);
        revers(pos+cnt+1,l);
        pos += cnt + 2;
    }
    cout << "end" << endl;
}
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 200 KB Execution killed with signal 13
2 Runtime error 0 ms 200 KB Execution killed with signal 13
3 Runtime error 0 ms 200 KB Execution killed with signal 13
4 Runtime error 0 ms 200 KB Execution killed with signal 13
5 Runtime error 0 ms 200 KB Execution killed with signal 13
6 Runtime error 0 ms 200 KB Execution killed with signal 13
7 Runtime error 1 ms 200 KB Execution killed with signal 13
8 Runtime error 1 ms 200 KB Execution killed with signal 13
9 Runtime error 1 ms 200 KB Execution killed with signal 13
10 Runtime error 0 ms 200 KB Execution killed with signal 13