Submission #922597

# Submission time Handle Problem Language Result Execution time Memory
922597 2024-02-05T18:44:34 Z Rainmaker2627 Aliens (IOI07_aliens) C++17
0 / 100
2 ms 700 KB
#include<bits/stdc++.h>
using namespace std;

int n, xs, ys;

bool inside(int x, int y) { return (x>0 && y>0 && x<=n && y<=n); }

bool examine(int i, int j) {
	if (!inside(i, j)) return false;
	cout << "examine " << i << ' ' << j << endl;
	string s;
	cin >> s;
	return s[0]=='t';
}

int find(int r, int d) {
	int i=0;
	while (examine(xs+(r<<i), ys+(d<<i))) i++;
	int lo=(1<<(i-1))-1, hi=(1<<i)-1;
	while (lo<hi) {
		int mid=(lo+hi)/2;
		if (examine(xs+mid*r, ys+mid*d)) lo=mid;
		else hi=mid;
	} return hi;
}

int main() {
	cin.tie(0)->sync_with_stdio(false);

	cin >> n >> xs >> ys;
	int r=find(1, 0), l=find(-1, 0), b=find(0, 1);
	int sz=r-l+1, t=b-sz;
	int x=(r+l)/2, y=(t+b)/2;

	while(examine(x+2*sz, y)) x+=2*sz;
	while(examine(x, y+2*sz)) y+=2*sz;
	while(examine(x+sz, y+sz)) x+=sz, y+=sz;

	cout << "solution " << x-2*sz << ' ' << y-2*sz << endl;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 448 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 456 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 448 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 448 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 448 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 700 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 456 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 456 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 456 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 452 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -