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>
#pragma GCC optimize("Ofast", "unroll-loops")
using namespace std;
#define ll long long
#define int ll
#define FOR(i,a, b) for (int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, n+1)
#define pii pair<int, int>
#define SZ(x) (int)((x).size())
#define ALL(x) (x).begin(), (x).end()
#define f first
#define s second
#define pb push_back
// #define endl '\n'
const ll maxn = 2e5+5;
const ll inf = (1ll<<60);
signed main(){
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int n, m, k, q; cin>>n>>m>>k>>q;
vector<int> val(n+1);
if (k==1&&m==1){
int l=1, r=n;
while(l<=r){
if (l==r){
cout<<'!'<<' '<<l<<' '<<1<<' '<<1<<endl;
break;
}
int mid1=(l+r)/2;
int mid2=mid1+1;
if(val[mid1]==0){
cout<<'?'<<' '<<mid1<<' '<<1<<' '<<1<<endl;
int x; cin>>x;
val[mid1]=x;
}
if (val[mid2]==0) {
cout<<'?'<<' '<<mid2<<' '<<1<<' '<<1<<endl;
int x; cin>>x;
val[mid2]=x;
}
if (val[mid1]<=val[mid2]){
l=mid2;
}
else {
r=mid1;
}
}
}
}
# | 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... |