This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pi;
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define fip(a,b) for(ll i = a; i < b ; i++)
#define fjp(a,b) for(ll j = a; j < b ; j++)
#define fp(k,a,b) for(ll k = a; k < b ; k++)
#define fin(a,b) for(ll i = a; i >= b ; i--)
#define fjn(a,b) for(ll i = a; j >= b ; j--)
#define fn(k,a,b) for(ll k = a; k >= b ; k--)
#define fx(a) fx(auto x : a)
#define ordered_set tree<pi,null_type,less<pi>,rb_tree_tag,tree_order_statistics_node_update>
#define total_one(k) __builtin_popcount(k)
#define back_zero(k) __builtin_ctzll(k)
#define front_zero(k) __builtin_clzll(k)
#define nli "\n"
ll n,m,ans,sum,res,cnt,tptp,tp,tp2;
const ll mx = 2e5 + 5;
const ll mod = 1e9 + 7;
ll query(ll k){
cout<<"? "<<k<<" 1 1\n";
cout.flush();
ll result;
cin>>result;
cout.flush();
return result;
}
void answer(ll k){
cout<<"! "<<k<<" 1 1\n";
cout.flush();
return;
}
ll find(ll l,ll r){
if(l==r)
return l;
ll mid = l + (r-l)/2;
ll val1 = query(mid);
ll val2 = query(mid+1);
if(val1>=val2){
return find(l,mid);
}else
return find(mid+1,r);
return 0;
}
int main(){
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
// #ifdef code
// freopen("input1.txt","r",stdin);
// freopen("output1.txt","w",stdout);
// freopen("error1.txt","w",stderr);
// #endif
cin>>n>>tp>>tp2>>m;
ans = find(1,n);
answer(ans);
// cerr << "Time elapsed : " << setprecision(6) << 100.00 * clock() / CLOCKS_PER_SEC << "ms\n";
}
# | 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... |