Submission #890395

# Submission time Handle Problem Language Result Execution time Memory
890395 2023-12-21T05:35:31 Z UmairAhmadMirza Aliens (IOI07_aliens) C++14
100 / 100
1 ms 344 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
	int n,x0,y0;
	cin>>n>>x0>>y0;
	string rep;
	//do binary search to find top line of any block
	int low=y0,high=n+1;
	while(high-low>1){
		int mid=(high+low)/2;
		cout<<"examine "<<x0<<' '<<mid<<endl;
		cin>>rep;
		if(rep=="false")
			high=mid;
		else
			low=mid;
	}
	y0=low;
	low=x0,high=n+1;
	while(high-low>1){
		int mid=(high+low)/2;
		cout<<"examine "<<mid<<' '<<y0<<endl;
		cin>>rep;
		if(rep=="false")
			high=mid;
		else
			low=mid;
	}
	x0=low;
	//want to bottom corner how must should be subtracted
	low=0,high=min(x0,y0);
	while(high-low>1){
		int mid=(low+high)/2;
		cout<<"examine "<<x0-mid<<' '<<y0-mid<<endl;
		cin>>rep;
		if(rep=="false")
			high=mid;
		else
			low=mid;
	}
	x0-=low;
	y0-=low;
	low=0,high=(n+1)-max(x0,y0);
	while(high-low>1){
		int mid=(high+low)/2;
		cout<<"examine "<<x0+mid<<' '<<y0+mid<<endl;
		cin>>rep;
		if(rep=="false")
			high=mid;
		else
			low=mid;
	}
	x0+=low/2;
	y0+=low/2;
	//now we are in the main diagonal
	high=min(y0,(n+1)-x0);
	low=0;
	while(high-low>1){
		int mid=(high+low)/2;
		cout<<"examine "<<x0+mid<<' '<<y0-mid<<endl;
		cin>>rep;
		if(rep=="false")
			high=mid;
		else
			low=mid;
	}
	x0+=low;
	y0-=low;
	// cout<<x0<<' '<<y0<<endl;
	high=min(x0,(n+1)-y0);
	low=0;
	while(high-low>1){
		int mid=(high+low)/2;
		cout<<"examine "<<x0-mid<<' '<<y0+mid<<endl;
		cin>>rep;
		if(rep=="false")
			high=mid;
		else
			low=mid;
	}
	x0-=low/2;
	y0+=low/2;
	cout<<"solution "<<x0<<' '<<y0<<endl;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct