Submission #895999

# Submission time Handle Problem Language Result Execution time Memory
895999 2023-12-31T11:58:50 Z pcc Worm Worries (BOI18_worm) C++14
0 / 100
221 ms 508548 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>


const int mxn = 1e6+10;
int N,M,K;
int dp[mxn];

namespace CHECK{
	vector<vector<vector<int>>> v;
	int ask(int x,int y = 1,int z = 1){
		cout<<v[x][y][z]<<endl;
		return v[x][y][z];
	}
	bool check(int x,int y = 1,int z = 1){
		int re =  v[x][y][z]>=max({v[x-1][y][z],v[x][y-1][z],v[x][y][z-1],v[x+1][y][z],v[x][y+1][z],v[x][y][z+1]});
		if(!re)cerr<<"WA"<<endl;
		else cerr<<"AC"<<endl;
		return 0;
	}
}

int C = 0;
int ask(int x,int y = 1,int z = 1){
	if(dp[x] != -1)return dp[x];
	cout<<"? "<<x<<' '<<y<<' '<<z<<endl;
	C++;
	int re;
	//re = CHECK::ask(x,y,z);
	cin>>re;
	if(re == -1)exit(0);
	dp[x] = re;
	return re;
}

int main(){
	memset(dp,-1,sizeof(dp));
	cin>>N>>M>>K;
	CHECK::v = vector<vector<vector<int>>>(N+2,vector<vector<int>>(M+2,vector<int>(K+2,0)));

	//for(int i = 1;i<=N;i++)for(int j = 1;j<=M;j++)for(int k = 1;k<=K;k++)cin>>CHECK::v[i][j][k];

	/*
   */

	int l = 1,r = N;
	while(r-l>1){
		int mid = (l+r)>>1;
		if(ask(mid)>=ask(mid+1))r = mid;
		else l = mid+1;
	}
	if(l == r)cout<<"! "<<l<<" 1 1"<<endl,CHECK::check(l,1,1);
	else if(ask(l)>ask(r))cout<<"! "<<l<<" 1 1"<<endl,CHECK::check(l,1,1);
	else cout<<"! "<<r<<" 1 1"<<endl,CHECK::check(r,1,1);
	cerr<<C<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 167 ms 200032 KB Output is correct
2 Correct 166 ms 200032 KB Output is correct
3 Incorrect 159 ms 200032 KB not a local maximum
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 128 ms 200036 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 6604 KB Output is correct
2 Incorrect 3 ms 6604 KB not a local maximum
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 55 ms 59452 KB Output is correct
2 Correct 53 ms 59432 KB Output is correct
3 Correct 51 ms 59436 KB Output is correct
4 Incorrect 57 ms 59428 KB not a local maximum
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 8872 KB Output is correct
2 Incorrect 3 ms 8876 KB not a local maximum
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 221 ms 508548 KB Output is correct
2 Incorrect 211 ms 508364 KB not a local maximum
3 Halted 0 ms 0 KB -