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>
#define fi first
#define se second
#define pb push_back
#define int long long
#define ll long long
using namespace std;
const int MAXN = 1e3+10;
const int LOG = 20;
const int SQRT = 4e3;
const int INF = 1e7;
typedef pair<int,int> pii;
typedef pair<int,pii> ipii;
int n, m, k, q;
int a[1010];
int ask(int x){
cout << "? " << x << " 1 1" << endl;
int ret; cin >> ret;
return ret;
}
void ans(int x){
cout << "! " << x << " 1 1" << endl;
}
void find(int l, int r){
while(r-l+1 >= 4){
int mid1 = (l+l+r)/3; int mid2 = (l+r+r+2)/3;
if(ask(mid1) < ask(mid2)){
l = mid1;
} else r = mid2;
}
int a1 = ask(l); int a2 = ask(l+1); int a3 = ask(l+2);
if(a1 >= a2) ans(l);
else if(a2 <= a3) ans(l+2);
else ans(l+1);
}
signed main() {
cin >> n >> m >> k >> q;
find(1, 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |