Submission #890350

# Submission time Handle Problem Language Result Execution time Memory
890350 2023-12-21T04:27:23 Z Faisal_Saqib Aliens (IOI07_aliens) C++17
0 / 100
2 ms 596 KB
#include <iostream>
using namespace std;
// const int M=212; // Trying for 100 points
const int M=100; // Trying for 40/60 points
int n,m;
string ans;
pair<int,int> just_do_it(int x0,int y0,bool swp=0) // One call take atmost M queries
{
	int to_right=-1;
	for(int j=1;j<=M;j++)
	{
		if((x0+j)>n)
		{
			to_right=j-1;
			break;
		}
		if(swp)
		{
			cout<<"examine "<<y0<<' '<<x0+j<<endl;
		}
		else
		{
			cout<<"examine "<<x0+j<<' '<<y0<<endl;
		}
		cin>>ans;
		if(ans=="false")
		{
			to_right=j-1;
			break;
		}
	}
	if(to_right==-1)
		to_right=M;
	if(swp)
		return {to_right,m-to_right-1};
	int to_left=-1;
	for(int j=1;j<=M;j++)
	{
		if((x0-j)<1)
		{
			to_left=j-1;
			break;
		}
		cout<<"examine "<<x0-j<<' '<<y0<<endl;
		cin>>ans;
		if(ans=="false")
		{
			to_left=j-1;
			break;
		}
	}
	if(to_left==-1)
		to_left=M;
	return {to_right,to_left};
}
int main()
{
	int x0,y0;
	cin>>n>>x0>>y0;
	auto ap=just_do_it(x0,y0);
	int to_right=ap.first;
	int to_left=ap.second;
	m=to_left+to_right+1;
	// cout<<m<<endl;
	ap=just_do_it(y0,x0,1);
	int to_up=ap.first;
	int to_down=ap.second;
	// cout<<to_left<<' '<<to_right<<endl;
	// cout<<to_up<<' '<<to_down<<endl;
	int right_most = x0+to_right;
	int left_most  = x0-to_left;
	int up_most = y0+to_up;
	int down_most  = y0-to_down;
	int center_x = (right_most+left_most)/2;
	int center_y = (up_most+down_most)/2;
	// cout<<center_y<<' '<<center_x<<endl;
	int final_x,final_y;
	{
		// find how many blocks above
		int block_up=0;
		for(int i=1;i<=(M/2);i++)
		{
			// Want to go one block up 
			// X remain same
			if((center_y + 2ll*i*m)>n)
			{
				block_up=i-1;
				break;
			}
			cout<<"examine "<<center_x<<' '<<(center_y + 2ll*i*m)<<endl;
			cin>>ans;
			if(ans=="false")
			{
				block_up=i-1;
				break;
			}
		}
		int block_down=m-block_up-1;
		final_y = ((center_y - 2ll*block_down*m) + (center_y + 2ll*block_up*m))/2;
	}
	{
		// find how many blocks above
		int block_right=0;
		for(int i=1;i<=(M/2);i++)
		{
			// Want to go one block up 
			// X remain same
			if((center_x + 2ll*i*m)>n)
			{
				block_right=i-1;
				break;
			}
			cout<<"examine "<<(center_x + 2ll*i*m)<<' '<<center_y<<endl;
			cin>>ans;
			if(ans=="false")
			{
				block_right=i-1;
				break;
			}
		}
		int block_left=m-block_right-1;
		final_x = ((center_x - 2ll*block_left*m) + (center_x + 2ll*block_right*m))/2;
	}
	cout<<"solution "<<final_x<<' '<<final_y<<endl;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Incorrect
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 1 ms 344 KB Incorrect
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 596 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 432 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 440 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -