This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;
const int MAXN = 2e5;
const int inf = 1e9;
double eps = 1e-5;
#define endl "\n"
#define dbg(x) cerr<<#x<<" = "<<x<<endl
int dx[] = {0, 0, -1, 1};
int dy[] = {-1, 1, 0, 0};
// #define with_testcases
int n;
bool query(ll x, ll y){
if(x > n || x <= 0 || y > n || y <= 0) return false;
cout << "examine " << x << ' ' << y << endl;
string s;
cin >> s;
return (s == "true" ? true : false);
}
void answer(ll x, ll y){
cout << "solution " << x << ' ' << y << endl;
exit(0);
}
void t_main(){
ll u, v;
cin >> n >> u >> v;
ll l = 1, r = v;
while(l != r){
ll m = (l+r)>>1;
if(query(u, m)) r=m;
else l=m+1;
}
ll v1 = l;
l = v, r = n;
while(l != r){
ll m = (l+r)>>1;
if(query(u, m)) l = m+1;
else r = m;
}
ll v2 = l;
ll m;
if(!query(u, v1+(v2-v1)/2)){
m = (v2-v1)/3;
} else {
if(query(u, v1+(v2-v1)/5)){
m = (v2-v1)/5;
} else {
m = (v2-v1);
}
}
ll V = v2;
l = u, r = u+m;
while(l != r){
ll m = (l+r+1)>>1;
if(query(m, V)) l = m;
else r = m-1;
}
ll U = l;
U = U - m/2;
V = V - m/2;
while(query(U-m, V-m)) U -= m, V -= m;
while(query(U-m, V)) U -= m;
answer(U+2*m, V+2*m);
}
signed main(){
signed t = 1;
// cin.tie(nullptr)->sync_with_stdio(false);
#ifdef with_testcases
cin >> t;
#endif
while(t--){
t_main();
cout << '\n';
}
return 0;
}
/*
_____ _____ _ _ ____ _ _ _____ _ _ _ _
| __ \ / ____| | | |/ __ \| | | | __ \| | | | | | |
| |__) | (___ | |__| | | | | |__| | |__) | | | | |__| |
| _ / \___ \| __ | | | | __ | _ /| | | | __ |
| | \ \ ____) | | | | |__| | | | | | \ \| |__| | | | |
|_| \_\_____/|_| |_|\____/|_| |_|_| \_\____ /|_| |_|
*/
# | 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... |