# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
959499 | 2024-04-08T10:30:29 Z | idas | Worm Worries (BOI18_worm) | C++11 | 3000 ms | 600 KB |
#include <bits/stdc++.h> #define f first #define s second #define pb push_back #define sz(x) ((int)((x).size())) #define le(vec) vec[vec.size()-1] #define all(x) (x).begin(), (x).end() #define TSTS int ttt; cin >> ttt; while(ttt--) solve() #define FAST_IO ios_base::sync_with_stdio(0); cin.tie(nullptr) #define FOR(i, begin, end) for(int i = (begin); i < (end); i++) using namespace std; typedef long long ll; typedef long double ld; typedef vector<int> vi; typedef map<int, int> mii; typedef pair<int, int> pii; typedef pair<long long, long long> pll; typedef pair<long double, long double> pdd; const int INF=1e9, MOD=1e9+7, mod=998244353; const ll LINF=1e18; void setIO() { FAST_IO; } void setIO(string s) { FAST_IO; freopen((s+".in").c_str(), "r", stdin); freopen((s+".out").c_str(), "w", stdout); } const int N=1e6+10; int n, M, K, q, dp[N]; int qr(int i, int j, int k) { if(--q<0){ while(true); } cout << "? " << i << " " << j << " " << k << endl; int ret; cin >> ret; dp[i]=ret; return ret; } int get(int i) { if(i==0||i==n+1) return 0; if(dp[i]!=0) return dp[i]; return qr(i, 1, 1); } int main() { setIO(); cin >> n >> M >> K >> q; int l=1, r=n; while(l<r){ int m=(l+r+1)/2; int a=get(m-1), b=get(m); if(a>=b) r=m-1; else l=m; } cout << "! " << l << " " << 1 << " " << 1 << endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 472 KB | Output is correct |
2 | Correct | 0 ms | 600 KB | Output is correct |
3 | Correct | 1 ms | 468 KB | Output is correct |
4 | Correct | 0 ms | 468 KB | Output is correct |
5 | Correct | 0 ms | 472 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3014 ms | 468 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Incorrect | 0 ms | 344 KB | not a local maximum |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 464 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Incorrect | 1 ms | 344 KB | not a local maximum |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Incorrect | 0 ms | 344 KB | not a local maximum |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Incorrect | 1 ms | 344 KB | not a local maximum |
3 | Halted | 0 ms | 0 KB | - |