답안 #659103

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
659103 2022-11-16T15:11:41 Z Trisanu_Das Aliens (IOI07_aliens) C++17
컴파일 오류
0 ms 0 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';
}

Compilation message

aliens.cpp: In function 'int main()':
aliens.cpp:17:29: error: expected ';' before ')' token
   17 |  for(int i = 1 << 30; i /= 2){
      |                             ^
      |                             ;