Submission #541426

#TimeUsernameProblemLanguageResultExecution timeMemory
541426LoboWorm Worries (BOI18_worm)C++17
0 / 100
3079 ms336 KiB
#include<bits/stdc++.h> using namespace std; const long long inf = (long long) 1e18 + 10; const int inf1 = (int) 1e9 + 10; #define int long long #define dbl long double // #define endl '\n' #define sc second #define fr first #define mp make_pair #define pb push_back #define all(x) x.begin(), x.end() const int maxn = 1e6 + 10; int n,aux,a[maxn]; int qrr(int x) { if(x == 0 || x == n+1 || a[x] != 0) return a[x]; cout << "? " << x << " 1 1" << endl; int o; cin >> o; return o; } void solve() { cin >> n >> aux >> aux >> aux; int l = 1; int r = n; int m1 = (l+r)/2; a[m1] = qrr(m1); int ans; while(l < r) { int mid = (l+r)/2; int m2 = mid; if(m1 == m2) { m2++; } if(m1 > m2) swap(m1,m2); a[m1] = qrr(m1); a[m2] = qrr(m2); if(a[m1] >= a[m2]) { //interval (l,m2-1) ans = l; r = m2-1; } else { //interval (m1+1,r) ans = r; l = m1+1; } } cout << "! " << ans << " 1 1" << endl; } int32_t main() { ios::sync_with_stdio(false); cin.tie(0); // freopen("in.in", "r", stdin); // freopen("out.out", "w", stdout); int tt = 1; // cin >> tt; while(tt--) solve(); }
#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...