結果

問題 No.246 質問と回答
ユーザー kichirb3kichirb3
提出日時 2018-03-26 19:22:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 54 ms / 2,000 ms
コード長 639 bytes
コンパイル時間 471 ms
コンパイル使用メモリ 10,764 KB
実行使用メモリ 24,276 KB
平均クエリ数 32.90
最終ジャッジ日時 2023-09-23 20:26:49
合計ジャッジ時間 3,588 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
24,096 KB
testcase_01 AC 50 ms
23,448 KB
testcase_02 AC 52 ms
23,952 KB
testcase_03 AC 48 ms
24,132 KB
testcase_04 AC 50 ms
24,108 KB
testcase_05 AC 48 ms
24,144 KB
testcase_06 AC 50 ms
23,928 KB
testcase_07 AC 48 ms
23,724 KB
testcase_08 AC 48 ms
23,892 KB
testcase_09 AC 49 ms
23,332 KB
testcase_10 AC 50 ms
24,168 KB
testcase_11 AC 51 ms
23,448 KB
testcase_12 AC 50 ms
23,916 KB
testcase_13 AC 51 ms
23,280 KB
testcase_14 AC 49 ms
23,736 KB
testcase_15 AC 50 ms
24,276 KB
testcase_16 AC 50 ms
23,556 KB
testcase_17 AC 50 ms
24,192 KB
testcase_18 AC 50 ms
24,156 KB
testcase_19 AC 50 ms
24,120 KB
testcase_20 AC 50 ms
23,952 KB
testcase_21 AC 51 ms
23,360 KB
testcase_22 AC 49 ms
24,108 KB
testcase_23 AC 51 ms
24,168 KB
testcase_24 AC 51 ms
23,868 KB
testcase_25 AC 48 ms
23,448 KB
testcase_26 AC 49 ms
23,724 KB
testcase_27 AC 51 ms
24,132 KB
testcase_28 AC 49 ms
23,304 KB
testcase_29 AC 49 ms
23,340 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-
"""
No.246 質問と回答
https://yukicoder.me/problems/no/246

"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    ub = 10**9
    lb = 1

    while ub > lb + 4:
        mid = (ub + lb) // 2
        print('? {}'.format(mid), flush=True)
        res = int(input())
        if res == 0:
            ub = mid
        else:
            lb = mid

    for i in range(lb, ub+2):
        print('? {}'.format(i), flush=True)
        res = int(input())
        if res == 0:
            print('! {}'.format(i-1), flush=True)
            break


if __name__ == '__main__':
    main(sys.argv[1:])
0