답안 #896006

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
896006 2023-12-31T12:12:18 Z pcc Worm Worries (BOI18_worm) C++14
0 / 100
1 ms 344 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 int ll


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

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

main(){
	cin>>N>>M>>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;
	}
	if(l == r)cout<<"! "<<l<<" 1 1"<<endl;
	else if(ask(l)<=ask(r))cout<<"! "<<r<<" 1 1"<<endl;
	else cout<<"! "<<l<<" 1 1"<<endl;
	return 0;
}

Compilation message

worm.cpp:27:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   27 | main(){
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB not a local maximum
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB too many queries. input: ? 986003 1 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB not a local maximum
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB not a local maximum
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB not a local maximum
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB not a local maximum
3 Halted 0 ms 0 KB -