Submission #541401

#TimeUsernameProblemLanguageResultExecution timeMemory
541401LoboWorm Worries (BOI18_worm)C++17
10 / 100
1 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; while(l <= r) { int m = (l+r)/2; a[m] = qrr(m); a[m-1] = qrr(m-1); a[m+1] = qrr(m+1); if(a[m-1] > a[m]) { r = m-1; } else if(a[m+1] > a[m]) { l = m+1; } else { cout << "! " << m << " 1 1" << endl; return; } } } 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...