結果
問題 | No.253 ロウソクの長さ |
ユーザー | jitomesky |
提出日時 | 2015-08-01 18:13:04 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,216 bytes |
コンパイル時間 | 234 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 28,280 KB |
平均クエリ数 | 31.06 |
最終ジャッジ日時 | 2024-07-16 05:33:54 |
合計ジャッジ時間 | 8,488 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 66 ms
27,208 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 48 ms
27,736 KB |
testcase_11 | WA | - |
testcase_12 | AC | 50 ms
27,608 KB |
testcase_13 | AC | 53 ms
27,480 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | AC | 49 ms
27,736 KB |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | AC | 49 ms
27,480 KB |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | AC | 50 ms
27,736 KB |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
ソースコード
import sys import math def question(num): print("? %d" % num) sys.stdout.flush() n = int(input()) return n def result(num): print("! %d" % num) sys.stdout.flush() def first_step(i, max_num, min_num): judge = int(max_num / 2) for i in range(i, 29): r = question(judge) if r == 1: # higer min_num = judge elif r == -1: # low max_num = judge else: return 1000, (judge+i) max_num -= 1 min_num -= 1 max_num = max_num if max_num >= 0 else 0 min_num = min_num if min_num >= 0 else 0 judge = int((max_num - min_num) / 2) + min_num return i, min_num def second_step(i, judge): for i in range(i, 100-i): r = question(judge) if r == 0: break return i # main max_num = 1e9 judge = int(max_num / 2) min_num = 10 # less than 100? r = question(100) max_num -= 1 min_num -= 1 if r == -1: r = second_step(1, min_num) elif r == 1: min_num = 100 - 1 i, min_num = first_step(1, max_num, min_num) if i > 100: r = min_num else: r = second_step(i, min_num) # 答えを出力 result(r)