Submission #706231

# Submission time Handle Problem Language Result Execution time Memory
706231 2023-03-06T07:00:41 Z vjudge1 Nizovi (COI14_nizovi) C++17
30 / 100
78 ms 416 KB
#include <bits/stdc++.h>
// #define endl '\n'
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int ll
typedef long long ll;
using namespace std;
const int N = 2e5 + 10;
int n, m;
signed main() {
    FAST;
    cin >> n >> m;
    int idx = n + 1;
    int left = n + 1, right = m + n;
    while(idx--) {
        if(idx == 0) {
            cout << "end" << endl;
            return 0;
        }
        int l = left, r = right;
        while(l < r) {
            int mid = (l + r) / 2;
            cout << "cmp " << idx << ' ' << mid << endl;
            int x; cin >> x;
            if(x == 1) l = mid + 1;
            else r = mid - 1;
        }
        cout << "cmp " << idx << ' ' << l << endl;
        int x; cin >> x;
        if(x == 1) {
            for(int i = idx; i < l; i++) cout << "reverse " << i << ' ' << i + 1 << endl;
            right = l - 1;
            left = idx;
        }
        else {
            for(int i = idx; i < l - 1; i++) cout << "reverse " << i << ' ' << i + 1 << endl;
            right = l - 2;
            left = idx;
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 3 ms 208 KB Output is correct
3 Correct 2 ms 208 KB Output is correct
4 Runtime error 57 ms 316 KB Execution killed with signal 13
5 Runtime error 63 ms 416 KB Execution killed with signal 13
6 Runtime error 78 ms 316 KB Execution killed with signal 13
7 Runtime error 48 ms 352 KB Execution killed with signal 13
8 Runtime error 49 ms 376 KB Execution killed with signal 13
9 Runtime error 51 ms 360 KB Execution killed with signal 13
10 Runtime error 50 ms 296 KB Execution killed with signal 13