Submission #222767

# Submission time Handle Problem Language Result Execution time Memory
222767 2020-04-14T01:38:44 Z mathking1021 Hotter Colder (IOI10_hottercolder) C++11
0 / 100
10000 ms 24508 KB
#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 time Memory Grader output
1 Execution timed out 10072 ms 1280 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 10048 ms 1280 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 10054 ms 1280 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 10065 ms 24508 KB Time limit exceeded