답안 #137041

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
137041 2019-07-27T02:05:00 Z StevenH Hotter Colder (IOI10_hottercolder) C++14
0 / 100
736 ms 8168 KB
#include "grader.h"
#include <cstdio>
using namespace std;
int left,right;
bool last;
int HC(int N){
	//printf("%d\n",N);
    left=1,right=N;
    last = 0;
    Guess(left);
    while(left+1 < right)
    {
    	//printf("%d %d\n",left,right);
    	int res;
    	int mid=(left+right)/2;
 		if(last==0)
 		{
 			res = Guess(right);
 			if(res == -1)
 			{
 				right = mid;
 				Guess(left);
 				last = 0;
 			}
 			else if(res == 1)
 			{

 				left = mid;
 				last = 1;	//next is left
 			}
 			else if(res == 0)
 			{
 				return mid;
 			}
 		}
 		else
 		{
 			res = Guess(left);
 			if(res == -1)
 			{
 				left = mid;
 				Guess(right);
 				last = 1;
 			}
 			else if(res == 1)
 			{
 				right = mid;
 				last = 0;	//next is left
 			}
 			else if(res == 0)
 			{
 				return mid;
 			}
 		}

    }
    
    if(right == left+1)
    {
    	//printf("%d\n",last);
    	int res;
    	if(last == 0)
    	{
    		res = Guess(right);
    		if(res == 1)return right;
    		else return left;
    	}
    	else if(last == 1)
    	{
    		res = Guess(left);
    		if(res == 1)return left;
    		else return right;
    	}
    }
}

Compilation message

hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:75:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 27 ms 1272 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 30 ms 1272 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 30 ms 1272 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 736 ms 8168 KB Output isn't correct - alpha = 0.000000000000