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 diagnostic warning "-std=c++11"
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define f first
#define s second
#define MOD 1000000007
#define flush fflush(stdout)
#define all(x) (x).begin(),(x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define pii pair<int,int>
using namespace std;
int n,m,T,k,x,y;
int ask(int x, int y) {
if (x<1 || x>m || y<1 || y>m) return 0;
cout<<"examine "<<x<<" "<<y<<endl;
string s; cin>>s;
return (s=="true");
}
void test_case() {
cin>>m>>x>>y;
int l=0,r=2e9,xmax;
while (l<=r) {
int mid=(l+r)/2;
int q1=ask(x+mid,y),q2=ask(x+mid/2,y),q3=ask(x+mid/4,y);
if (q1 && q2 && q3) {
xmax=x+mid; l=mid+1;
}
else {
r=mid-1;
}
}
x=xmax;
l=0; r=2e9; int xmin;
while (l<=r) {
int mid=(l+r)/2;
int q1=ask(x-mid,y),q2=ask(x-mid/2,y),q3=ask(x-mid/4,y);
if (q1 && q2 && q3) {
xmin=x-mid; l=mid+1;
}
else {
r=mid-1;
}
}
n=xmax-xmin+1;
l=0; r=2e9; int ymax;
while (l<=r) {
int mid=(l+r)/2;
int q1=ask(x,y+mid),q2=ask(x,y+mid/2),q3=ask(x,y+mid/4);
if (q1 && q2 && q3) {
ymax=y+mid; l=mid+1;
}
else {
r=mid-1;
}
}
// cout<<xmax<<" "<<ymax<<endl;
int mnx=3,mny=3;
for (int i=-2; i<=0; i++) {
int xx=xmax+n*i,yy=ymax;
int q=ask(xx,yy);
if (q) {
mnx=min(mnx,i);
}
}
for (int i=-2; i<=0; i++) {
int xx=xmax,yy=ymax+n*i;
int q=ask(xx,yy);
if (q) {
mny=min(mny,i);
}
}
int i1=mnx+2,i2=mny+2;
int x2=xmax+n*i1,y2=ymax+n*i2;
int half=n/2;
cout<<"solution "<<x2-half<<" "<<y2-half<<endl;
}
main () {
ios :: sync_with_stdio(0);
cin.tie(0); cout.tie(0);
T=1;
while (T--) test_case();
}
Compilation message (stderr)
aliens.cpp:1:32: warning: '-std=c++11' is not an option that controls warnings [-Wpragmas]
1 | #pragma GCC diagnostic warning "-std=c++11"
| ^~~~~~~~~~~~
aliens.cpp:80:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
80 | main () {
| ^~~~
aliens.cpp: In function 'void test_case()':
aliens.cpp:76:19: warning: 'ymax' may be used uninitialized in this function [-Wmaybe-uninitialized]
76 | int x2=xmax+n*i1,y2=ymax+n*i2;
| ^~
aliens.cpp:47:8: warning: 'xmin' may be used uninitialized in this function [-Wmaybe-uninitialized]
47 | n=xmax-xmin+1;
| ~~~~^~~~~
aliens.cpp:76:6: warning: 'xmax' may be used uninitialized in this function [-Wmaybe-uninitialized]
76 | int x2=xmax+n*i1,y2=ymax+n*i2;
| ^~
# | 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... |