Submission #706265

#TimeUsernameProblemLanguageResultExecution timeMemory
706265vjudge1Nizovi (COI14_nizovi)C++17
30 / 100
74 ms356 KiB
#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, in = idx; while(l <= r) { int mid = (l + r) / 2; cout << "cmp " << idx << ' ' << mid << endl; int x; cin >> x; if(x == 1) { l = mid + 1; in = mid; } else { r = mid - 1; } } if(idx < in) { cout << "cmp " << idx << ' ' << in << endl; int x; cin >> x; if(x == 1) { for(int i = idx; i < in; i++) cout << "reverse " << i << ' ' << i + 1 << endl; right = in - 1; left = idx; } else { for(int i = idx; i < in - 1; i++) cout << "reverse " << i << ' ' << i + 1 << endl; right = in - 2; left = idx; } } } }
#Verdict Execution timeMemoryGrader output
Fetching results...