답안 #436211

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
436211 2021-06-24T10:25:51 Z dutch Aliens (IOI07_aliens) C++17
100 / 100
5 ms 328 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
 
int n, x, y;
 
bool q(int i, int j){
	if(min(i, j) < 1 || max(i, j) > n) return 0;
	cout << "examine " << i << ' ' << j << endl;
	string res; cin >> res;
	return res[0] == 't';
}
 
signed main(){
	cin.tie(0)->sync_with_stdio(0);
	cin >> n >> x >> y;
	int x0 = x, x1 = x, y1 = y;
 
	for(int i=1<<30; i/=2; ){
		if(q(x1+i/1, y) && q(x1+i/2, y) && q(x1+i/4, y)) x1 += i;
		if(q(x0-i/1, y) && q(x0-i/2, y) && q(x0-i/4, y)) x0 -= i;
		if(q(x, y1+i/1) && q(x, y1+i/2) && q(x, y1+i/4)) y1 += i;
	}
 
	int w = 2*(x1 - x0 + 1);
	int y0 = y1 - (x1 - x0);
	x = (x0 + x1) / 2;
	y = (y0 + y1) / 2;
 
	x0 = x1 = x;
	y0 = y1 = y;
 
	while(q(x0-w, y)) x0 -= w;
	while(q(x1+w, y)) x1 += w;
 
	while(q(x, y0-w)) y0 -= w;
	while(q(x, y1+w)) y1 += w;
 
	cout << "solution " << (x0+x1)/2 << ' ' << (y0+y1)/2 << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 2 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 200 KB Output is correct
2 Correct 2 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 2 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 2 ms 200 KB Output is correct
3 Correct 2 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 328 KB Output is correct
2 Correct 3 ms 200 KB Output is correct
3 Correct 3 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 200 KB Output is correct
2 Correct 2 ms 200 KB Output is correct
3 Correct 2 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 2 ms 200 KB Output is correct
3 Correct 5 ms 200 KB Output is correct