# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
151853 | 2019-09-05T06:18:45 Z | davitmarg | Hotter Colder (IOI10_hottercolder) | C++17 | 780 ms | 8188 KB |
/*DavitMarg*/ #include <iostream> #include <algorithm> #include <cmath> #include <vector> #include <string> #include <cstring> #include <map> #include <unordered_map> #include <set> #include <queue> #include <iomanip> #include <stack> #include <cassert> #include <iterator> #include <bitset> #include <fstream> #define mod 1000000007ll #define LL long long #define LD long double #define MP make_pair #define PB push_back #define all(v) v.begin(),v.end() using namespace std; #ifndef death #include "grader.h"; #endif #ifdef death int Guess(int a) { cout<<"! "<<a<<endl; int res; cin>>res; return res; } #endif int HC(int n) { int l=1; int r=n; int m; int ans,ord=1; Guess(l); while(l<=r) { m=(l+r)/2; if(l==r) { ans=m; break; } int res; if(ord) res=Guess(r); else { res=Guess(l); res*=-1; } if(res==0) { ans=m; break; } if(res==1) { //if(ord==0 && l!=r) Guess(r); l=m+1; ord=0; } else { //if(ord==1 && l!=r) Guess(l); r=m-1+(r-l)%2; ord=1; } } return ans; } #ifdef death int main() { cout<<HC(6)<<endl; return 0; } #endif /* */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 29 ms | 1272 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 31 ms | 1272 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 29 ms | 1400 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 780 ms | 8188 KB | Output is partially correct - alpha = 0.034482758621 |