답안 #10086

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
10086 2014-10-10T07:34:59 Z gyunt Hotter Colder (IOI10_hottercolder) C++
0 / 100
2247 ms 262144 KB
#include <iostream>
#include "grader.h"

using namespace std;

int HC(int n)
{
    int min = 1, max = n, previous_guess = 1, guess = 0, hot_cool;
    Guess(1);
    
    while (min < max)
    {
        guess = min + max - previous_guess;
        hot_cool = Guess(guess);
        
        if (hot_cool == 0)
        {
            return ((previous_guess + guess) >> 1);
        }
        
        int mid = (previous_guess + guess) / 2;
        int mod = (previous_guess + guess) & 1;
        
        if (hot_cool > 0)
        {
            if (guess > previous_guess)
                min = mid + mod;
            else
                max = mid;
        }
        else
        {
            if (guess > previous_guess)
                max = mid;
            else
                min = mid + mod;
        }
        
        previous_guess = guess;
    }
    return min;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 155 ms 59128 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 110 ms 59236 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 119 ms 59128 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2247 ms 262144 KB Output isn't correct - alpha = 0.000000000000