답안 #123424

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
123424 2019-07-01T12:27:00 Z TuGSGeReL Aliens (IOI07_aliens) C++17
30 / 100
4 ms 376 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define mp make_pair
#define pub push_back
#define pob pop_back()
#define ss second
#define ff first
#define mt make_tuple
#define pof pop_front()
#define fbo find_by_order
#define ook order_of_key
#define lb lower_bound
#define ub upper_bound

typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
using pll = pair <int, int>;
using pii = pair <ll, ll>;

ll n, x, y, k = 1, rib, leb, upb, m;
	
bool examine(ll a, ll b)
{
	if ( a <= 0 || b <= 0 || a > n || b > n )
		return 0;
	
	string bo;
	cout << "examine " << a << " " << b << "\n";
	cin >> bo;
	
	if ( bo == "true" )
		return 1;
	
	return 0;
}

int main ()
{
	ios_base::sync_with_stdio(false);
//	cin.tie(0);
//	cout.tie(0);
	
	cin >> n >> x >> y;

	while (examine(x, k + y))
		k = k * 2;
	
	ll l = y, r = y + k;
	
	while (l + 1 < r)
	{
		ll mid = (l + r) / 2;
		
		if ( examine(x, mid) )
			l = mid;
		
		else
			r = mid;
	}
	
	if ( examine(x, r) )
		rib = r;
	
	else
		rib = l;
	
	k = 1;
	while (examine(x, y - k))
		k = k * 2;
	
	l = y - k, r = y;
	
	while (l + 1 < r)
	{
		ll mid = (l + r) / 2;
	
		if ( examine(x, mid) )
			r = mid;
		
		else
			l = mid;
	}
	
	if ( examine(x, l) )
		leb = l;
	
	else
		leb = r;
	
	m = rib - leb + 1;
	
	k = 1;
	while (examine(x - k, y))
		k = k * 2;
	
	l = x - k, r = x;
	
	while (l + 1 < r)
	{
		ll mid = (l + r) / 2;
		
		if ( examine(mid, y) )
			r = mid;
		
		else
			l = mid;
	}
	
	if ( examine(l, y) )
		upb = l;
	
	else
		upb = r;
	
	y = leb + m / 2;
	x = upb + m / 2;
	
	while ( x + 2 * m <= n && examine(x + m * 2, y) )
		x += m * 2;
	
	while ( y + 2 * m <= n && examine(x, y + m * 2) )
		y += m * 2;
	
	cout << "solution " << x - 2 * m << " " << y - 2 * m << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 248 KB Incorrect
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Incorrect 2 ms 276 KB Incorrect
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Incorrect 2 ms 248 KB Incorrect
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Incorrect 2 ms 276 KB Incorrect
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Incorrect 2 ms 376 KB Incorrect
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 376 KB Output is correct
2 Correct 3 ms 248 KB Output is correct
3 Correct 2 ms 248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Incorrect 3 ms 248 KB Incorrect