답안 #108916

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
108916 2019-05-02T17:03:00 Z MetB Aliens (IOI07_aliens) C++14
20 / 100
1000 ms 384 KB
#include <iostream>
#include <cstdlib>
#include <string>
#include <set>
#include <map>
#include <algorithm>
#include <bitset>
#include <queue>
#include <math.h>
#include <stack>
#include <vector>
#include <string.h>
#include <random>

typedef long long ll;

const ll MOD = 1e9 + 7, INF = 1e18;

using namespace std;

ll n, x, y, min_x, max_x, min_y, max_y;

bool query (ll x, ll y)
{
	if (x <= 0 || x > n || y <= 0 || y > n) return false;
	cout << "examine " << x << ' ' << y << endl;
	fflush (stdout);

	string s;

	cin >> s;

	if (s == "true") return true;
	else return false;
}

int main ()
{
	cin >> n >> x >> y;

	max_x = min_x = x;
	max_y = min_y = y;

	int p = 1;

	while (query (x + p, y))
	{
		p *= 2;
	}

	int l = x + p / 2, r = x + p;

	while (l < r)
	{
		int mid = (l + r + 1) / 2;

		if (query (mid, y)) l = mid;
		else r = mid - 1;
	}

	max_x = l;

	p = 1;

	while (query (x - p, y))
	{
		p *= 2;
	}

	l = x - p, r = x - p / 2;

	while (l < r)
	{
		int mid = (l + r) / 2;

		if (query (mid, y)) r = mid;
		else l = mid + 1;
	}

	min_x = l;

	p = 1;

	while (query (x, y + p))
	{
		p *= 2;
	}

	l = y + p / 2, r = y + p;

	while (l < r)
	{
		int mid = (l + r + 1) / 2;

		if (query (x, mid)) l = mid;
		else r = mid - 1;
	}

	max_y = l;

	p = 1;

	while (query (x, y - p))
	{
		p *= 2;
	}

	l = y - p, r = y - p / 2;

	while (l < r)
	{
		int mid = (l + r) / 2;

		if (query (x, mid)) r = mid;
		else l = mid + 1;
	}

	min_y = l;

	ll m = max_x - min_x + 1;

	x = (min_x + max_x) / 2;
	y = (min_y + max_y) / 2;

	ll x_c = x - 2 * m;
	ll y_c = y - 2 * m;

	if (query (x + 2 * m, y)) x_c += 2 * m;
	if (query (x + 4 * m, y)) x_c += 2 * m;
	if (query (x, y + 2 * m)) y_c += 2 * m;
	if (query (x, y + 4 * m)) y_c += 2 * m;

	cout << "solution " << x_c << ' ' << y_c << endl;
	fflush (stdout);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 2 ms 384 KB Incorrect
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Incorrect 3 ms 256 KB Incorrect
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Incorrect 3 ms 384 KB Incorrect
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Incorrect 3 ms 384 KB Incorrect
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Incorrect 3 ms 384 KB Incorrect
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Execution timed out 3086 ms 256 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Execution timed out 3018 ms 256 KB Time limit exceeded
3 Halted 0 ms 0 KB -