Submission #645423

# Submission time Handle Problem Language Result Execution time Memory
645423 2022-09-27T06:16:19 Z gun_gan Aliens (IOI07_aliens) C++17
10 / 100
3 ms 208 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long

const int dx[4] = {1, -1, -1, 1}, dy[4] = {-1, -1, 1, 1};
int n, X_[2], Y_[2], q = 0;


bool ask(int x, int y) {
	q++;
	assert(q <= 300);
	if(x <= 0 || y <= 0 || x > n || y > n) return 0;
	cout << "examine " << x << " " << y << endl;
	string s; cin >> s;
	return s == "true";
}

void work(int x, int y) {
	int x1 = 0, x2 = 0, y1 = 0, y2 = 0;
	{
		int l = 0, r = 2e9;
		while(l <= r) {
			int mid = (l + r) / 2;
			if(ask(x, y + 2 * mid)) {
				l = mid + 1, y2 = y + 2 * mid;
			} else {
				r = mid - 1;
			}
		}
	}
	{
		int l = 0, r = 2e9;
		while(l <= r) {
			int mid = (l + r) / 2;
			if(ask(x, y - 2 * mid)) {
				l = mid + 1, y1 = y - 2 * mid;
			} else {
				r = mid - 1;
			}
		}
	}
	{
		int l = 0, r = 2e9;
		while(l <= r) {
			int mid = (l + r) / 2;
			if(ask(x - 2 * mid, y)) {
				l = mid + 1, x1 = x - 2 * mid;
			} else {
				r = mid - 1;
			}
		}
	}
	{
		int l = 0, r = 2e9;
		while(l <= r) {
			int mid = (l + r) / 2;
			if(ask(x + 2 * mid, y)) {
				l = mid + 1, x2 = x + 2 * mid;
			} else {
				r = mid - 1;
			}
		}
	}
	X_[0] = min(X_[0], x1);
	Y_[0] = min(Y_[0], y1);
	X_[1] = max(X_[1], x2);
	Y_[1] = max(Y_[1], y2);
	// cout << X_[0] << " " << Y_[0] << " " << X_[1] << " " << Y_[1] << endl;
}

signed main() {
	cin.tie(0); ios_base::sync_with_stdio(0);

	int x, y;
	cin >> n >> x >> y;

	X_[0] = 2e9, Y_[0] = 2e9;

	work(x, y);
	int X = 0, Y = 0;
	for(int i = 0; i < 4; i++) {
		if(ask(x + dx[i], y + dy[i])) {
			X = x + dx[i], Y = y + dy[i];
			break;
		}
	}
	work(X, Y);

	assert((X_[0] + X_[1]) / 2 >= 1 && (X_[0] + X_[1]) / 2 <= n && (Y_[0] + Y_[1]) / 2 >= 1 && (Y_[0] + Y_[1]) / 2 <= n);
	cout << "solution " << (X_[0] + X_[1]) / 2 << " " << (Y_[0] + Y_[1]) / 2 << endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 2 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Incorrect 3 ms 208 KB Incorrect
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Incorrect 3 ms 208 KB Incorrect
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Incorrect 2 ms 208 KB Incorrect
4 Halted 0 ms 0 KB -