Submission #706237

#TimeUsernameProblemLanguageResultExecution timeMemory
706237vjudge1Nizovi (COI14_nizovi)C++17
0 / 100
1 ms308 KiB
#include <bits/stdc++.h> #include <fstream> //#define endl '\n' #define mod 998244353 #define INF 100000000000 #define ll long long ///#define cin fin ///#define cout fout #define fi first #define se second using namespace std; ///ofstream fout("herding.out"); ///ifstream fin("herding.in"); int main() { ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0); int n1, n2; cin >> n1 >> n2; int l1 = 1, r1 = n1, l2 = n1+1, r2 = n2+n1, l = -1, r = -1; while(l1 <= r1) { int mid1 = (l1+r1)/2; cout << "cmp" << ' ' << mid1 << ' ' << l2 << endl; int x; cin >> x; if(x < 0) { l1 = mid1+1; } else { r1 = mid1-1; l = mid1; } } if(l == -1) { cout << "end" << endl; return 0; } while(l2 <= r2) { int mid2 = (l2+r2)/2; cout << "cmp" << ' ' << l << ' ' << mid2 << endl; int x; cin >> x; if(x < 0) { r2 = mid2-1; } else { l2 = mid2+1; r = mid2; } } cout << "reverse" << ' ' << l << ' ' << r << endl; cout << "reverse" << ' ' << l << ' ' << l+(r-(n1+1)) << endl; cout << "reverse" << ' ' << r-(n1-l) << ' ' << r << endl; cout << "end" << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...