이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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){
cout<<"? "<<x<<' '<<y<<' '<<z<<endl;
int re;
cin>>re;
return re;
}
int main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin>>N>>M>>K>>mx;
if(M != 0||K != 0)return 0;
int l = 1,r = N,ml = 1+N/(phi+1),mr = N-N/(phi+1);
while(ml < mr){
if(ask(ml)>ask(mr)){
r = mr;
mr = r-(r-l+1)/(phi+1);
}
else{
l = ml;
ml = l+(r-l+1)/(phi+1);
}
}
if(ask(ml)>ask(mr))cout<<"! "<<ml<<" 1 1"<<endl;
else cout<<"! "<<mr<<" 1 1"<<endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |