답안 #105422

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
105422 2019-04-12T08:16:17 Z SOIVIEONE Aliens (IOI07_aliens) C++17
0 / 100
4 ms 384 KB
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>

#define INF 1000000021
#define MOD 1000000007
#define pb push_back
#define sqr(a) (a)*(a)
#define M(a, b) make_pair(a,b)
#define T(a, b, c) make_pair(a, make_pair(b, c))
#define F first
#define S second
#define all(x) (x.begin(), x.end())
#define deb(x) cerr << #x << " = " << x << '\n'
#define N 222222

using namespace std;
//using namespace __gnu_pbds;

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const ld pi = 2 * acos(0.0);
template<class T> bool umin(T& a, T b){if(a>b){a=b;return 1;}return 0;}
template<class T> bool umax(T& a, T b){if(a<b){a=b;return 1;}return 0;}
template<class T, class TT> bool pal(T a, TT n){int k=0;for(int i=0;i<=n/2;i++){if(a[i]!=a[n-i-1]){k=1;break;}}return k?0:1;}

//int month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};

int ask(ll x, ll y)
{
	cout << "examine " << x << ' ' << y << '\n';
	cout.flush();
	string q;
	cin >> q;
	return (q[0] == 't');
}

int main()
{
	ll n, x, y;
	cin >> n >> x >> y;
	ll p = 1;
	while(x + p <= n && ask(x + p, y))
		p *= 2;
	ll l = x + p / 2, r = min(x + p, n);
	while(l < r)
	{
		ll m = (l + r) >> 1ll;
		if(ask(m, y))
			l = m + 1;
		else
			r = m;
	}
	ll hoo = l;
	p = 1;
	while(x - p >= 0 && ask(x - p, y))
		p *= 2;
	l = max(x - p, 0ll), r = x - p / 2;
	while(l < r)
	{
		ll m = (l + r) >> 1ll;
		if(ask(m, y)) 
			r = m;
		else
			l = m + 1;
	}
	ll foo = l;
	ll m = hoo - foo + 1;
	ll cur = x, lx = 1,lef = 0;
	while(ask(cur-m+m, y))
	{
		lef = cur;
		cur -= (m + m);
		lx ++;
	}
	p = 1;
	while(y <= n && ask(x, y + p))
		p *= 2;
	l = y + p / 2; r = min(y + p, n);
	while(l < r)
	{
		ll m = (l + r) >> 1ll;
		if(ask(x, m))
			l = m + 1;
		else
			r = m;
	}
	ll rx = foo, ry = l;
	ll ax = m*5+rx-1, ay = m*5+ry-1;
	cout << "solution " << (rx + ax) / 2 << ' ' << (ry + ay) / 2 << '\n';
	cout.flush();

	getchar();
	getchar();
	return 0;
	//ios::sync_with_stdio(false);
	//cin.tie(0);
}

Compilation message

aliens.cpp: In function 'int main()':
aliens.cpp:74:21: warning: variable 'lef' set but not used [-Wunused-but-set-variable]
  ll cur = x, lx = 1,lef = 0;
                     ^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 384 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 384 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 304 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 384 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 384 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 384 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 256 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 284 KB Incorrect
2 Halted 0 ms 0 KB -