# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1074126 | 2024-08-25T08:11:43 Z | Hugo1729 | Hotter Colder (IOI10_hottercolder) | C++11 | 403 ms | 24420 KB |
#include "grader.h" #include <bits/stdc++.h> using namespace std; int p; int make_guess(int x){ int sus = Guess(x); // cout << x << ' ' << sus << '\n'; return sus; } int HC(int N){ // int g = make_guess(1); // int h = make_guess(N); // if (g == 0) return N/2; // if (g < 0) return N/4; // if (g > 0) return 3*N/4; // cout << N << '\n'; p=-1; int lo=1,hi=N; while(lo<hi){ int mid=(hi+lo)/2; if(p==-1){ int g1 = make_guess(mid),g2=make_guess(mid+1); p=mid+1; if(g2==1){ lo=mid+1; }else{ hi=mid; } }else{ int query=min(N,max(1,(lo+hi-p))); int g=make_guess(query); if(g==0){ // cout << (query+p)/2 << "\n\n"; return (query+p)/2; } else if(query<p){ if(g==1)hi=(p+query)/2; else lo=(p+query+1)/2; }else{ if(g==-1)hi=(p+query)/2; else lo=(p+query+1)/2; } p=query; } // cout << "a: " << lo << ' ' << hi << '\n'; } // cout << lo << "\n\n"; return lo; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 18 ms | 6748 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 18 ms | 6748 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 17 ms | 6748 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 403 ms | 24420 KB | Output is partially correct - alpha = 0.148148148148 |