Submission #244380

#TimeUsernameProblemLanguageResultExecution timeMemory
244380TadijaSebezWorm Worries (BOI18_worm)C++11
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
map<array<int,3>,int> was;
int n,m,k,q;
int Ask(int i,int j,int k){
	if(was.count({i,j,k}))return was[{i,j,k}];
	if(i<1||j<1||k<1||i>n||j>m||k>::k)return 0;
	printf("? %i %i %i\n",i,j,k);
	fflush(stdout);
	int b;scanf("%i",&b);
	was[{i,j,k}]=b;
	return b;
}
void Ans(int i,int j,int k){
	printf("! %i %i %i\n",i,j,k);
	fflush(stdout);
	exit(0);
}
int main(){
	scanf("%i %i %i %i",&n,&m,&k,&q);
	if(m==1&&k==1){
		int top=n,bot=1,mid;
		while(top>bot){
			mid=top+bot>>1;
			if(Ask(mid,1,1)<Ask(mid+1,1,1))bot=mid+1;
			else top=mid;
		}
		Asn(bot,1,1);
	}else if(k==1){
		/*int X1=1,X2=n,Y1=1,Y2=n;
		while(X1<X2&&Y1<Y2){
			int Xm=X1+X2>>1;
			int mx=0,pos=0;
			for(int i=Y1;i<=Y2;i++){
				int now=Ask(Xm,i,1);
				if(now>mx)mx=now,pos=i;
			}
			if(Ask(Xm-1,pos,1)>mx){
				X2=Xm-1;
			}else if(Ask(Xm+1,pos,1)>mx){
				X1=Xm+1;
			}else Ans(Xm,pos,1);
			int Ym=Y1+Y2>>1;
			mx=0,pos=0;
			for(int i=X1;i<=X2;i++){

			}
		}*/
	}else{

	}
	return 0;
}

Compilation message (stderr)

worm.cpp: In function 'int main()':
worm.cpp:24:11: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
    mid=top+bot>>1;
        ~~~^~~~
worm.cpp:28:3: error: 'Asn' was not declared in this scope
   Asn(bot,1,1);
   ^~~
worm.cpp:28:3: note: suggested alternative: 'Ask'
   Asn(bot,1,1);
   ^~~
   Ask
worm.cpp: In function 'int Ask(int, int, int)':
worm.cpp:10:13: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  int b;scanf("%i",&b);
        ~~~~~^~~~~~~~~
worm.cpp: In function 'int main()':
worm.cpp:20:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%i %i %i %i",&n,&m,&k,&q);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~