답안 #1046424

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1046424 2024-08-06T14:22:14 Z EntityPlantt Hotter Colder (IOI10_hottercolder) C++17
0 / 100
380 ms 47888 KB
#include "grader.h"

int HC(int n) {
	int l = 1, r = n;
	while (l < r) {
		Guess(l);
		int ans = Guess(r);
		if (!ans) {
			// ista dalecina
			return l + r >> 1;
		}
		else if (ans == 1) {
			// poblisku e do desno
			l = (l + r >> 1) + 1;
		}
		else {
			// poblisku e do levo
			r = (l + r >> 1) - 1;
		}
	}
	return l;
}

Compilation message

hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:10:13: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   10 |    return l + r >> 1;
      |           ~~^~~
hottercolder.cpp:14:11: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   14 |    l = (l + r >> 1) + 1;
      |         ~~^~~
hottercolder.cpp:18:11: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   18 |    r = (l + r >> 1) - 1;
      |         ~~^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 16 ms 5980 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 16 ms 5720 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 16 ms 5784 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 380 ms 47888 KB Output isn't correct - alpha = 0.000000000000
2 Halted 0 ms 0 KB -