Submission #222767

#TimeUsernameProblemLanguageResultExecution timeMemory
222767mathking1021Hotter Colder (IOI10_hottercolder)C++11
0 / 100
10072 ms24508 KiB
#include "grader.h" #include <iostream> using namespace std; int ans = 0; int n = 0; //void init() //{ // const int M = 50000000; // ve.push_back(1), ve.push_back(1), ve.push_back(3); // while(ve.back() < M) // { // ve.push_back(ve[ve.size() - 2] + ve[ve.size() - 1] + 1); // } //} void f(int p, int q, int r) { if(r == 0) { Guess(p); int t = Guess(q); if(t == 1) { f((p + q + 2) / 2, q, q); } else if(t == -1) { f(p, (p + q - 1) / 2, q); } else { ans = (p + q) / 2; } return; } int t = p + q - r; t = max(t, 1); t = min(t, n); int y = t + r; if(2 * p > y || y > 2 * q) { Guess(p); int x = Guess(q); if(x == 1) { f((p + q + 2) / 2, q, q); } else if(x == -1) { f(p, (p + q - 1) / 2, q); } else { ans = (p + q) / 2; } return; } int x = Guess(t); if(x == 1) { f((y + 2) / 2, q, t); } else if(x == -1) { f(p, (y - 1) / 2, t); } else { ans = y / 2; } } int HC(int N) { n = N; ans = 0; f(1, n, 0); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...