답안 #659104

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
659104 2022-11-16T15:12:52 Z Trisanu_Das Aliens (IOI07_aliens) C++17
100 / 100
3 ms 292 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 << '\n';
	string s; cin >> s;
	return s == "true";
}
 
signed main(){
	cin >> n >> x >> y;
	int x0 = x, x1 = x, y1 = y;
	for(int i = 1 << 30; i /= 2;){
		if(q(x1 + i, y) && q(x1 + i / 2, y) && q(x1 + i / 4, y)) x1 += i;
		if(q(x0 - i, y) && q(x0 - i / 2, y) && q(x0 - i / 4, y)) x0 -= i;
		if(q(x, y1 + i) && q(x, y1 + i / 2) && q(x, y1 + i / 4)) y1 += i;
	}
	int w = 2 * (x1 - x0 + 1), 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 << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 2 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 2 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 2 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 2 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 2 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 208 KB Output is correct
2 Correct 1 ms 292 KB Output is correct
3 Correct 3 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 208 KB Output is correct
2 Correct 2 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 2 ms 208 KB Output is correct
3 Correct 2 ms 208 KB Output is correct