結果

問題 No.253 ロウソクの長さ
ユーザー TawaraTawara
提出日時 2015-08-01 18:18:04
言語 Python2
(2.7.18)
結果
RE  
実行時間 -
コード長 504 bytes
コンパイル時間 456 ms
コンパイル使用メモリ 6,620 KB
実行使用メモリ 24,432 KB
平均クエリ数 17.92
最終ジャッジ日時 2023-09-23 05:35:03
合計ジャッジ時間 6,265 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 38 ms
23,676 KB
testcase_02 AC 37 ms
23,568 KB
testcase_03 AC 36 ms
23,544 KB
testcase_04 AC 35 ms
23,952 KB
testcase_05 AC 37 ms
23,316 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 34 ms
23,472 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 36 ms
24,276 KB
testcase_15 AC 38 ms
24,300 KB
testcase_16 AC 35 ms
23,976 KB
testcase_17 AC 35 ms
23,652 KB
testcase_18 RE -
testcase_19 AC 35 ms
24,000 KB
testcase_20 RE -
testcase_21 AC 37 ms
23,448 KB
testcase_22 AC 35 ms
23,352 KB
testcase_23 RE -
testcase_24 AC 37 ms
23,664 KB
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 AC 35 ms
23,472 KB
testcase_35 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
def ask(Y):
	print "? %d" % Y
	sys.stdout.flush()
	res = int(raw_input())
	return res

res = ask(100)
if res == 0:
	print "! %d" % 100
elif res == -1:
	for i in range(99):
		if ask(0) == 0:
			print "! %d" % (i+1)
			break
else:
	X = 10**9-1
	left = 100
	right = 10**9 + 1
	for i in range(99):
		mid = (left + right) / 2
		print X - i
		res = ask(mid)
		if res == 0:
			print "! %d" % (i+1+mid)
			break
		elif res == -1:
			left -= 1
			right = mid - 1
		else:
			left = mid - 1
			right -= 1
0