Submission #963761

# Submission time Handle Problem Language Result Execution time Memory
963761 2024-04-15T15:41:23 Z pcc Worm Worries (BOI18_worm) C++17
0 / 100
1 ms 460 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>
#define ld long double


ll N,M,K,mx;
const ld phi = (1+sqrt(5))/2;
map<int,int> mp;

int ask(int x,int y = 1,int z = 1){
	if(mp.find(x) != mp.end())return mp[x];
	cout<<"? "<<x<<' '<<y<<' '<<z<<endl;
	int re;
	cin>>re;
	return mp[x] = re;
}

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>N>>M>>K>>mx;
	if(M != 1||K != 1)return 0;
	int l = 1,r = N,ml = 1+N/(phi+1),mr = N-N/(phi+1);
	while(ml < mr){
		//cout<<l<<' '<<ml<<' '<<mr<<' '<<r<<endl;
		if(ask(ml)>ask(mr)){
			r = mr;
			mr = ml;
			ml = l+(r-l+1)/(phi+1);
		}
		else{
			l = ml;
			ml = mr;
			mr = r-(r-l+1)/(phi+1);
		}
	}
	cout<<l<<' '<<r<<endl<<endl;
	vector<pii> v;
	for(int i = l;i<=r;i++)v.push_back(pii(ask(i),i));
	sort(v.rbegin(),v.rend());
	cout<<"! "<<v[0].sc<<" 1 1"<<endl;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 460 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 452 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB invalid format (must have DIMS+1 tokens). input:
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB invalid format (must have DIMS+1 tokens). input:
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB invalid format (must have DIMS+1 tokens). input:
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB invalid format (must have DIMS+1 tokens). input:
2 Halted 0 ms 0 KB -