Submission #436135

# Submission time Handle Problem Language Result Execution time Memory
436135 2021-06-24T09:18:58 Z dutch Aliens (IOI07_aliens) C++17
30 / 100
5 ms 256 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long

int n, x, y;

bool q(int i, int j){
	if(min(i, j) < 1 || max(i, j) > n) return 0;
	cout << "examine " << i << ' ' << j << endl;
	string res; cin >> res;
	return res[0] == 't';
}

signed main(){
	cin.tie(0)->sync_with_stdio(0);
	cin >> n >> x >> y;
	int xMax = x, xMin = x, yMax = y;

	for(int i=1<<30, j; i/=2; ){
		j = xMax + i;
		if(q(j, y) && q((j+xMax)/2, y) && q(xMax+i/4, y)) xMax += i;
		j = yMax + i;
		if(q(x, j) && q(x, (j+yMax)/2) && q(x, yMax+i/4)) yMax += i;
		j = xMin - i;
		if(q(j, y) && q((j+xMin)/2, y) && q(xMin-i/4, y)) xMin -= i;
	}

	int w = 2*(xMax - xMin + 1);
	int yMin = yMax - (xMax - xMin);
	x = (xMin + xMax) / 2;
	y = (yMin + yMax) / 2;

	xMin = xMax = x;
	yMin = yMax = y;

	if(q(x-w, y)) xMin -= w;
	if(q(x-w, y)) xMin -= w;
	if(q(x+w, y)) xMax += w;
	if(q(x+w, y)) xMax += w;

	if(q(x, y-w)) yMin -= w;
	if(q(x, y-w)) yMin -= w;
	if(q(x, y+w)) yMax += w;
	if(q(x, y+w)) yMax += w;

	cout << "solution " << (xMin+xMax)/2 << ' ' << (yMin+yMax)/2 << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Output is correct
2 Incorrect 1 ms 200 KB Incorrect
# Verdict Execution time Memory Grader output
1 Correct 2 ms 200 KB Output is correct
2 Correct 2 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Output is correct
2 Incorrect 2 ms 200 KB Incorrect
# Verdict Execution time Memory Grader output
1 Correct 2 ms 200 KB Output is correct
2 Incorrect 2 ms 200 KB Incorrect
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Incorrect 3 ms 200 KB Incorrect
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 256 KB Output is correct
2 Incorrect 5 ms 200 KB Incorrect
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 200 KB Output is correct
2 Correct 3 ms 200 KB Output is correct
3 Correct 2 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 200 KB Output is correct
2 Correct 2 ms 200 KB Output is correct
3 Incorrect 4 ms 200 KB Incorrect