Submission #121997

# Submission time Handle Problem Language Result Execution time Memory
121997 2019-06-27T10:36:53 Z khulegub Aliens (IOI07_aliens) C++14
0 / 100
8 ms 384 KB
#include<bits/stdc++.h>


using namespace std;




bool exam(int x, int y){
	if(x < 1 || y < 1) return 0;
	cout << "examine " << x << ' ' << y << endl;
	string ans;
	cin >> ans;
	return ans[0]=='t';
}
void sol(int x, int y){
	cout << "solution " << x << ' ' << y << endl;
}



int main(){
	// freopen("in.txt", "r", stdin);
	int n;
	// cin >> n;
	// for (int i = 1; i <= n; i++){
	// 	for (int j = 1; j <= n; j++){
	// 		cin >> arr[i][j];
	// 	}
	// }
	// int x0 = 5, y0 = 7;
	int x0, y0;
	cin >> n >> x0 >> y0;
	int usreh = 1;
	while(exam(x0 + usreh, y0) == 1){
		usreh *= 2;
	}
	int l = 0, r = usreh;
	int mx = 0;
	while(l <= r){
		if(l == r){
			if(exam(x0 + l, y0)) mx = max(mx, l);
			break;
		}
		int mid = (l + r) / 2;
		if(exam(x0 + mid, y0)){
			mx = max(mx, mid);
			l = mid + 1;
		}
		else r = mid - 1;
	}
	int mxx = x0 + mx;
	usreh = 1;
	while(exam(x0 - usreh, y0) == 1){
		usreh *= 2;
	}
	l = 0, r = usreh;
	mx = 0;
	while(l <= r){
		if(l == r){
			if(exam(x0 - l, y0)) mx = max(mx, l);
			break;
		}
		int mid = (l + r) / 2;
		if(exam(x0 - mid, y0)){
			mx = max(mx, mid);
			l = mid + 1;
		}
		else r = mid - 1;
	}
	int mnx = x0 - mx;
	usreh = 1;
	while(exam(x0, y0 + usreh) == 1){
		usreh *= 2;
	}
	l = 0, r = usreh;
	mx = 0;
	while(l <= r){
		if(l == r){
			if(exam(x0, y0 + l)) mx = max(mx, l);
			break;
		}
		int mid = (l + r) / 2;
		if(exam(x0, y0 + mid)){
			mx = max(mx, mid);
			l = mid + 1;
		}
		else r = mid - 1;
	}
	int mxy = y0 + mx;
	usreh = 1;
	while(exam(x0, y0 - usreh) == 1){
		usreh *= 2;
	}
	l = 0, r = usreh;
	mx = 0;
	while(l <= r){
		if(l == r){
			if(exam(x0, y0 - l)) mx = max(mx, l);
			break;
		}
		int mid = (l + r) / 2;
		if(exam(x0, y0 - mid)){
			mx = max(mx, mid);
			l = mid + 1;
		}
		else r = mid - 1;
	}
	int mny = y0 - mx;
	int m = mxy - mny + 1;
	int cntrx = (mnx + mxx) >> 1;
	int cntry = (mny + mxy) >> 1;
	usreh = 1;
	while (exam(cntrx + usreh * 2 * m, cntry)){
		usreh *= 2;
	}
	l = 0, r = usreh;
	mx = 0;
	while (l <= r){
		if(l == r){
			if(exam(cntrx + l * 2 * m, cntry)) mx = max(mx, l);
			break;
		}
		int mid = (l + r) >> 1;
		if(exam(cntrx + mid * 2 * m, cntry)){
			mx = max(mx, mid);
			l = mid + 1;
		}
		else r = mid - 1;
	}
	int xmax = mx;
	usreh = 1;
	while (exam(cntrx - usreh * 2 * m, cntry)){
		usreh *= 2;
	}
	l = 0, r = usreh;
	mx = 0;
	while (l <= r){
		if(l == r){
			if(exam(cntrx - l * 2 * m, cntry)) mx = max(mx, l);
			break;
		}
		int mid = (l + r) >> 1;
		if(exam(cntrx - mid * 2 * m, cntry)){
			mx = max(mx, mid);
			l = mid + 1;
		}
		else r = mid - 1;
	}
	int xmin = mx;
	usreh = 1;
	while (exam(cntrx , cntry + usreh * 2 * m)){
		usreh *= 2;
	}
	l = 0, r = usreh;
	mx = 0;
	while (l <= r){
		if(l == r){
			if(exam(cntrx, cntry  + l * 2 * m)) mx = max(mx, l);
			break;
		}
		int mid = (l + r) >> 1;
		if(exam(cntrx, cntry  + mid * 2 * m)){
			mx = max(mx, mid);
			l = mid + 1;
		}
		else r = mid - 1;
	}
	int ymax = mx;
	usreh = 1;
	while (exam(cntrx , cntry - usreh * 2 * m)){
		usreh *= 2;
	}
	l = 0, r = usreh;
	mx = 0;
	while (l <= r){
		if(l == r){
			if(exam(cntrx, cntry  - l * 2 * m)) mx = max(mx, l);
			break;
		}
		int mid = (l + r) >> 1;
		if(exam(cntrx, cntry - mid * 2 * m)){
			mx = max(mx, mid);
			l = mid + 1;
		}
		else r = mid - 1;
	}
	int ymin = mx;
	int wewe = xmax + xmin + 1;
	int hehe = ymax + ymin + 1;
	wewe /= 2;
	hehe /= 2;
	int xexe = cntrx + 2 * m * (wewe - xmin);
	int yeye = cntry + 2 * m * (hehe - ymin);
	sol(yeye, n -xexe +1);
	// cout << yeye << ' ' << n - xexe + 1;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 2 ms 256 KB Incorrect
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 3 ms 256 KB Incorrect
# Verdict Execution time Memory Grader output
1 Correct 8 ms 256 KB Output is correct
2 Incorrect 2 ms 256 KB Incorrect
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 384 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 384 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 384 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Incorrect 4 ms 256 KB Incorrect
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 384 KB Incorrect
2 Halted 0 ms 0 KB -