Submission #733660

#TimeUsernameProblemLanguageResultExecution timeMemory
733660ByeWorldWorm Worries (BOI18_worm)C++14
10 / 100
1 ms292 KiB
#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*382/1000; if(mid2 == -1) mid2 = l + len*618/1000; 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; } } 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...