#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
int N,M;
map<pair<int,int>,bool>vis;
map<pair<int,int>,string>res;
int r=0;
string check(int x,int y)
{
if (res[{x,y}]=="true"||res[{x,y}]=="false")
return res[{x,y}];
cout<<"examine "<<x<<' '<<y<<endl;
r++;
string z;
cin>>z;
res[{x,y}]=z;
return z;
}
vector<pair<int,int>>ind;
void dfs(int x,int y)
{
if (x>N||y>N)
return;
if (vis[{x,y}])
return;
vis[{x,y}]=1;
string z=check(x,y);
if (z=="true")
{
ind.push_back({x,y});
dfs(x,y+1);
dfs(x,y-1);
}
}
void dfs1(int x,int y)
{
if (x>N||y>N||x<=0||y<=0)
return;
if (vis[{x,y}])
return;
vis[{x,y}]=1;
if (check(x,y)=="true")
{
ind.push_back({x,y});
dfs1(x+2*M,y);dfs1(x-2*M,y);dfs1(x,y+2*M);dfs1(x,y-2*M);
}
}
inline void solve()
{
int x,y;
cin>>N>>x>>y;
vis={};
res={};
ind.push_back({x,y});
res[{x,y}]="true";
vis[{x,y}]=1;
dfs(x,y+1);
dfs(x,y-1);
sort(begin(ind),end(ind));
M=ind.size();
x=ind[M/2].first,y=ind[M/2].second;
int st=-(M/2)-1,en=M/2+1;
while (st+1<en)
{
int mid=(st+en)/2;
if (check(x+mid+(M/2),y)=="false")
en=mid;
else
st=mid;
}
ind={};
vis={};
ind.push_back({x+st,y});
dfs1(x+st,y);
sort(begin(ind),end(ind));
cout<<"solution ";
cout<<ind[5].first<<' '<<ind[5].second<<endl;
}
int main()
{
solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
436 KB |
Incorrect |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
432 KB |
Output is correct |
2 |
Incorrect |
1 ms |
440 KB |
Incorrect |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
440 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
692 KB |
Incorrect |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
940 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
436 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
436 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
504 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
700 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
504 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |