답안 #970800

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
970800 2024-04-27T09:40:36 Z starchan Aliens (IOI07_aliens) C++17
100 / 100
2 ms 344 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define in array<int, 2>
#define pb push_back
#define pob pop_back
#define INF (int)1e17
#define MX (int)3e5+5
#define fast() ios_base::sync_with_stdio(false); cin.tie(NULL)
array<int, 4> gr[5][5];
array<int, 4> FF;
int N;
bool QQ(int x, int y)
{
	if((x <= 0) || (y <= 0) || (x > N) || (y > N))
		return false;
	cout << "examine " << x << " " << y << endl;
	string can; cin >> can;
	return can=="true";
}
int dx[4] = {-1, 1, 0, 0}; int dy[4] = {0, 0, -1, 1};
int ddx[4] = {1, -1, 1, -1}; int ddy[4] = {1, 1, -1, -1}; 
signed main()
{
	fast();
	for(int i = 0; i < 5; i++)
	{
		for(int j = 0; j < 5; j++)
		{
			for(int k = 0; k < 4; k++)
			{
				int ip, jp; ip = i; jp = j;
				while((ip >= 0) && (ip < 5) && (jp >= 0) && (jp < 5))
				{
					ip+=ddx[k];
					jp+=ddy[k];
					gr[i][j][k]++;
				}
			}
			 
		}
	}	
	int x, y;
	cin >> N >> x >> y;
	int xp[4], yp[4];
	for(int i = 0; i < 4; i++)
	{
		xp[i] = x;
		yp[i] = y;
	}
	int pw = 1;
	for(int i = 0; i < 3; i++)
	{
		while(true)
		{
			if(QQ(xp[i]+pw*dx[i], yp[i]+pw*dy[i]))
			{
				xp[i]+=(pw*dx[i]); yp[i]+=(pw*dy[i]);
				pw*=2;
			}
			else
			{
				if(pw == 1)
					break;
				pw/=2;
			}
		}
	}
	//0 --> L; 1 --> R; 2 --> D
	int K = (xp[1]-xp[0])/2;
	int M = 2*K+1;
	int Cx = xp[0]+K; int Cy = yp[2]+K;
	for(int i = 0; i < 4; i++)
	{
		int Xp = Cx; int Yp = Cy;
		while(QQ(Xp, Yp))
		{
			Xp+=(M*ddx[i]);
			Yp+=(M*ddy[i]);
			FF[i]++;
		}
	}
	int cx = Cx; int cy = Cy;
	for(int i = 0; i < 5; i++)
	{
		for(int j = 0; j < 5; j++)
		{
			if(FF == gr[i][j])
			{
				cx+=(M*(2-i));
				cy+=(M*(2-j));
			}
		}
	}
	cout << "solution " << cx << " " << cy << endl;
	return 0;
}	
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct