This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
int n, a, b;
map <int,bool> vis;
signed main(){
cin >> n >> a >> b;
int x = a, y = b;
while(1){
int l = 1, r = y, k = 0;
bool tr = 0;
string s1;
if(tr == 0){
tr = 1;
cout << "examine " << x << " " << l << '\n';
cin >> s1;
if(s1 == "true"){
y = l;
break;
}
}
vis.clear();
while(l < r-1){
int md = (l + r) / 2;
cout << "examine " << x << " " << md << '\n';
string s;
cin >> s;
if(s == "true"){
r = md;
}
else {
l = md;
}
if(vis[md] == 1) break;
vis[md] = 1;
}
cout << "examine " << x << " " << l << '\n';
cin >> s1;
if(s1 == "true") k = l;
else k = r;
if(k == y) break;
y = k;
}
while(1){
int l = 1, r = x, k = 0;
bool tr = 0;
string s1;
if(tr == 0){
tr = 1;
cout << "examine " << l << " " << y << '\n';
cin >> s1;
if(s1 == "true"){
x = l;
break;
}
}
vis.clear();
while(l < r-1){
int md = (l + r) / 2;
cout << "examine " << md << " " << y << '\n';
string s;
cin >> s;
if(s == "true"){
r = md;
}
else {
l = md;
}
if(vis[md] == 1) break;
vis[md] = 1;
}
cout << "examine " << l << " " << y << '\n';
cin >> s1;
if(s1 == "true") k = l;
else k = r;
if(k == x) break;
x = k;
}
if(x > 1 and y > 1){
cout << "examine " << x-1 << " " << y-1 << '\n';
string s2;
cin >> s2;
if(s2 == "true"){
x--, y--;
int l = 1, r = y, k = 0;
while(l <= r){
int md = (l + r) / 2;
cout << "examine " << x << " " << md << '\n';
cin >> s2;
if(s2 == "true"){
r = md-1;
k = md;
}
else {
l = md+1;
}
}
y = k;
l = 1, r = x;
while(l <= r){
int md = (l + r) / 2;
cout << "examine " << md << " " << y << '\n';
cin >> s2;
if(s2 == "true"){
r = md-1;
k = md;
}
else {
l = md+1;
}
}
x = k;
}
}
int y1 = y;
while(1){
int l = y, r = n, k = 0;
bool tr = 0;
string s1;
if(tr == 0){
tr = 1;
cout << "examine " << x << " " << r << '\n';
cin >> s1;
if(s1 == "true"){
y = r;
break;
}
}
vis.clear();
while(l < r-1){
int md = (l + r) / 2;
cout << "examine " << x << " " << md << '\n';
string s;
cin >> s;
if(s == "true"){
l = md;
}
else {
r = md;
}
if(vis[md] == 1) break;
vis[md] = 1;
}
cout << "examine " << x << " " << r << '\n';
cin >> s1;
if(s1 == "true") k = r;
else k = l;
if(k == y) break;
y = k;
}
int m = abs(y1-y)+1;
m /= 5;
swap(y,y1);
x += m*2;
y += m*2;
x += m/2;
y += m/2;
cout << "solution " << x << ' ' << y;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |