#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Incorrect |
2 |
Incorrect |
1 ms |
208 KB |
Incorrect |
3 |
Incorrect |
1 ms |
208 KB |
Incorrect |
4 |
Incorrect |
1 ms |
208 KB |
Incorrect |
5 |
Incorrect |
1 ms |
208 KB |
Incorrect |
6 |
Incorrect |
0 ms |
208 KB |
Incorrect |
7 |
Incorrect |
1 ms |
208 KB |
Incorrect |
8 |
Incorrect |
1 ms |
308 KB |
Incorrect |
9 |
Incorrect |
1 ms |
208 KB |
Incorrect |
10 |
Incorrect |
1 ms |
208 KB |
Incorrect |