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){
int len = r-l+1;
int mid1 = -1; int mid2 = -1;
int val1 = -1; int val2 = -1;
while(r-l+1 >= 4){
len = r-l+1;
if(mid1 == -1) mid1 = l + len*3819/10000;
if(mid2 == -1) mid2 = r - len*3819/10000;
if(val1 == -1) val1 = ask(mid1);
if(val2 == -1) val2 = ask(mid2);
if(val1 < val2){
l = mid1;
mid1 = mid2; val1 = val2;
mid2 = -1; val2 = -1;
} else {
r = mid2;
mid2 = mid1; val2 = val1;
mid1 = -1; val1 = -1;
}
}
//cout << l << " l\n";
int x[6]; x[0] = 0; x[r-l+2] = 0;
for(int i=1; i<=r-l+1; i++) x[i] = ask(i+l-1);
for(int i=1; i<=r-l+1; i++){
//cout << i << ' ' << x[i] << "p\n";
if(max(x[i-1], x[i+1]) <= x[i]){
ans(i+l-1); break;
}
}
}
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... |