답안 #597777

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
597777 2022-07-16T21:01:33 Z NekoRolly Aliens (IOI07_aliens) C++17
100 / 100
3 ms 284 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

ll n,x,y,M;
ll Lx,Rx,Ly,Ry;
ll l,r;

int Query(ll m,int f){ string s;
	if (m < 1 || n < m) return -1;
	if (f) cout << "examine " << m << " " << y << endl;
	else cout << "examine " << x << " " << m << endl;
	cin >> s; return s == "true";
}

void GoLR(bool f,ll &L,ll &R){
	for (l=1, r=f?x:y; l<r; ){ ll m = (l+r)/2;
		if (Query(m, f)) r = m;
		else l = m+1;
	}
	L = l;

	for (l=f?x:y, r=n; l<r; ){ ll m = (l+r+1)/2;
		if (Query(m, f)) l = m;
		else r = m-1;
	}
	R = r, M = R - L + 1;
	// cout << L << " " << R << "\n";

	if (M%3 == 0 && Query(L + M/3, f) == 0 && Query(L + M/3 - 1, f) == 1) M /= 3, R -= 2*M;
	if (M%5 == 0 && Query(L + M/5, f) == 0 && Query(L + M/5 - 1, f) == 1) M /= 5, R -= 4*M;

	for (; Query(L - 2*M, f) == 1; ) L -= 2*M, R -= 2*M;
}

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

	cin >> n >> x >> y;

	GoLR(1, Lx, Rx), GoLR(0, Ly, Ry);

	if (Lx > M && Ly > M){ string s;
		cout << "examine " << Lx - M << " " << Ly - M << endl;
		cin >> s; if (s == "true") Lx -= M, Ly -= M;
	}

	// cout << Lx << " " << Ly << " " << M << endl;
	cout << "solution " << Lx + (5*M - 1)/2 << " " << Ly + (5*M - 1)/2 << endl;

	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 284 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 2 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 208 KB Output is correct
2 Correct 2 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 236 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 208 KB Output is correct
2 Correct 2 ms 208 KB Output is correct
3 Correct 2 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 208 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 2 ms 256 KB Output is correct