Submission #890389

# Submission time Handle Problem Language Result Execution time Memory
890389 2023-12-21T05:25:40 Z Muhammad_Aneeq Aliens (IOI07_aliens) C++17
0 / 100
1 ms 696 KB
#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 (x<=0||x>N||y<=0||y>N)
		return "false";
	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 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}]=1;
	int st=0,en=2;
	while (1)
	{
		int mid=(st+en)/2;
		if (check(x,y+mid)=="true")
			en*=2;
		else
			break;
	}
	st=en/4-1;
	while (st+1<en)
	{
		int mid=(st+en)/2;
		if (check(x,y+mid)=="true")
			st=mid;
		else
			en=mid;
	}
	int ed=st;
	st=0,en=2;
	while (1)
	{
		int mid=en/2;
		if (check(x,y-mid)=="true")
			en*=2;
		else
			break;
	}
	st=en/4-1;
	while (st+1<en)
	{
		int mid=(st+en)/2;
		if (check(x,y-mid)=="true")
			st=mid;
		else
			en=mid;
	}
	M=ed+en;
	y=(y+ed+y-st+1)/2;
	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 0 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 0 ms 432 KB Incorrect
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 588 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 0 ms 432 KB Incorrect
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 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 Incorrect 1 ms 432 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 436 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 696 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 1 ms 436 KB Output is correct
2 Incorrect 1 ms 428 KB Incorrect
3 Halted 0 ms 0 KB -