# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1074401 | 2024-08-25T10:18:02 Z | beaconmc | Hotter Colder (IOI10_hottercolder) | C++14 | 1960 ms | 262144 KB |
#include "grader.h" #include <bits/stdc++.h> typedef long long ll; #define FOR(i,x,y) for(ll i=x; i<y; i++) #define FORNEG(i,x,y) for(lli = x; i>y; i--) using namespace std; ll n; map<ll,ll> sus; ll cnt = 0; ll idkman = -1; int guess(ll a){ if (a==0) return -1; if (a==n+1) return -1; cnt++; idkman = a; return Guess(a); } int solve(int a, int b){ // cout << a << " " << b << endl; ll lmao = rand()%2; // cout << lmao << endl; // cout << a << " " << b << endl; if (a==b) return a; if (idkman == (a+b)/2){ // cout << "LMAO" << endl; ll mid = idkman; ll right = guess(idkman+1); if (right == -1){ return solve(a, mid); }else{ return solve(mid+1, b); } } else{ if (lmao == 0){ ll mid = (a+b)/2; ll midleft = (a+mid)/2; ll midright = (b+mid+1)/2; ll left, right; left = guess(midleft); right = guess(midright); if (right == 0 ){ return (midleft+midright)/2; } else if (right == -1){ return solve(a,mid); }else{ return solve(mid+1, b); } } else{ ll mid = (a+b)/2; ll midleft = (a+mid)/2; ll midright = (b+mid+1)/2; ll left, right; right = guess(midright); left = guess(midleft); // cout << a << " " << b << " " << midleft << " " << midright << " " << left << " " << right << endl; if (left == 0 ){ return (midleft+midright)/2; } else if (left == -1){ solve(mid+1, b); }else{ return solve(a, mid); } } } } int HC(int N){ idkman = -1; srand(time(0)); sus.clear(); n = N; cnt = 0; ll ans = solve(1,N); // cout << ans << " " << cnt << endl; return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 64 ms | 48880 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 12 ms | 13148 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 11 ms | 13144 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1960 ms | 262144 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |