답안 #356457

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
356457 2021-01-23T11:46:33 Z Mefarnis Hotter Colder (IOI10_hottercolder) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;

void HC(int n) {
	int l = 1 , r = n , last = 1;
	Guess(last);
	while(l < r) {
		int mid = (l+r) >> 1;
		int x = (last == l) ? r : l;
		int val = Guess(x);
		if(val == 0)
			return mid;
		int y = (val == 1) ? x : last;
		if((l+r)%2 == 0) {
			if(y == l)
				r = mid-1;
			else
				l = mid+1;
		}
		else {
			if(y == l)
				r = mid;
			else
				l = mid+1;
		}
		last = x;
	}
	return l;
}

Compilation message

hottercolder.cpp: In function 'void HC(int)':
hottercolder.cpp:13:11: error: return-statement with a value, in function returning 'void' [-fpermissive]
   13 |    return mid;
      |           ^~~
hottercolder.cpp:29:9: error: return-statement with a value, in function returning 'void' [-fpermissive]
   29 |  return l;
      |         ^