Submission #70951

# Submission time Handle Problem Language Result Execution time Memory
70951 2018-08-23T20:19:49 Z thebes Aliens (IOI07_aliens) C++14
0 / 100
1000 ms 536 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long
int N, M, x, y, i, d, a, lo, hi;
string inp;
bool get(int x,int y){
	printf("examine %lld %lld\n",x,y);
	fflush(stdout);
	cin >> inp;
	return inp == "true";
}
signed main(){
	scanf("%lld%lld%lld",&N,&x,&y);
	for(i=0;x+(1LL<<i)<=N;i++){
		if(!get(x+(1LL<<i),y)) break;
	}
	lo = 0, hi = 1LL<<i;
	while(lo<hi){
		int m=lo+hi>>1;
		if(!get(x+m,y)) hi=m;
		else lo=m+1;
	}
	lo--; d = lo; a = 0;
	for(i=0;x-(1LL<<i)>=1;i++){
		if(!get(x-(1LL<<i),y)) break;
	}
	lo = 0, hi = 1LL<<i;
	while(lo<hi){
		int m=lo+hi>>1;
		if(!get(x-m,y)) hi=m;
		else lo=m+1;
	}
	lo--; M = 1+lo+a; a=0;
	x += (M/2)-lo;
	printf("%d %d\n",x,y); // -------------------------------
	for(i=0;y+(1LL<<i)<=N;i++){
		if(!get(x,y+(1LL<<i))) break;
	}
	lo = 0, hi = 1LL<<i;
	while(lo<hi){
		int m=lo+hi>>1;
		if(!get(x,y+m)) hi=m;
		else lo=m+1;
	}
	lo--; y -= (M/2)-lo;
	int l=0, r=0, u=0, d=0;
	for(i=1;2*M*i+x<=N;i++){
		if(!get(x+2*M*i,y)) break;
	}
	r = i-1;
	for(i=1;x-2*M*i>=1;i++){
		if(!get(x-2*M*i,y)) break;
	}
	l = i-1;
	for(i=1;y+2*M*i<=N;i++){
		if(!get(x,y+2*M*i)) break;
	}
	u = i-1;
	for(i=1;y-2*M*i>=1;i++){
		if(!get(x,y-2*M*i)) break;
	}
	d = i-1;
	if(l+r==1){
		if(!r) x -= M;
		else x += M;
		if(!u) y -= M;
		else y += M;
	}
	else{
		x += 2*M*(r-1);
		y += 2*M*(u-1);
	}
	printf("solution %lld %lld\n",x,y);
	fflush(stdout);
	return 0;
}

Compilation message

aliens.cpp: In function 'int main()':
aliens.cpp:20:11: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   int m=lo+hi>>1;
         ~~^~~
aliens.cpp:30:11: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   int m=lo+hi>>1;
         ~~^~~
aliens.cpp:36:22: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
  printf("%d %d\n",x,y); // -------------------------------
                      ^
aliens.cpp:36:22: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long long int' [-Wformat=]
aliens.cpp:42:11: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   int m=lo+hi>>1;
         ~~^~~
aliens.cpp:47:21: warning: variable 'd' set but not used [-Wunused-but-set-variable]
  int l=0, r=0, u=0, d=0;
                     ^
aliens.cpp:14:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld%lld%lld",&N,&x,&y);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB Expected integer, but "examine" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 436 KB Expected integer, but "examine" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 436 KB Expected integer, but "examine" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 436 KB Expected integer, but "examine" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 488 KB Expected integer, but "examine" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 488 KB Expected integer, but "examine" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 488 KB Expected integer, but "examine" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1068 ms 488 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 488 KB Expected integer, but "examine" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 536 KB Expected integer, but "examine" found
2 Halted 0 ms 0 KB -