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>
#define maxn (int)(1e5+51)
#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define ll long long
#define pb push_back
#define ull unsigned long long
#define ii pair<int,int>
#define iii tuple<int,int,int>
#define inf 2000000001
#define mod 1000000007 //998244353
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
template<typename X, typename Y> bool ckmin(X& x, const Y& y) { return (y < x) ? (x=y,1):0; }
template<typename X, typename Y> bool ckmax(X& x, const Y& y) { return (x < y) ? (x=y,1):0; }
int q = 0;
void tle(){
while(true){
cout<<"a"<<endl;
}
}
bool query(ll x,ll y){
q++;
cout<<"examine "<<x<<" "<<y<<endl;
string s;cin>>s;
if(q==296)tle();
return s=="true";
}
int main(){_
ll n,x0,y0;cin>>n>>x0>>y0;
ll l,r,leftmost = x0,rightmost = x0,topmost = y0;
bool ok = true;
while(ok){
ok = false;
l = 1LL, r = leftmost-1LL;
while(l<=r){
ll md = l + (r-l+1LL)/2;
if(query(md,y0)){
leftmost = md;
r = md-1LL;
ok = true;
}else{
l = md+1LL;
}
}
}
//rightmost
ok = true;
while(ok){
ok = false;
l = rightmost + 1LL, r = n;
while(l<=r){
ll md = l + (r-l+1LL)/2;
if(query(md,y0)){
rightmost = md;
l = md+1LL;
ok = true;
}else r = md-1LL;
}
}
//topmost
ok = true;
while(ok){
l = topmost+1LL, r = n;
ok = false;
while(l<=r){
ll md = l + (r-l+1)/2;
if(query(x0,md)){
topmost = md;
l = md+1LL;
ok = true;
}else r = md-1LL;
}
}
ll len = rightmost - leftmost + 1;
ll xc = leftmost + len/2, yc = topmost - len/2;
cout<<"solution "<<xc<<" "<<yc<<endl;
}
# | 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... |