結果

問題 No.1830 Balanced Majority
ユーザー ShirotsumeShirotsume
提出日時 2022-02-04 22:18:07
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 348 bytes
コンパイル時間 332 ms
コンパイル使用メモリ 87,012 KB
実行使用メモリ 95,252 KB
平均クエリ数 11.92
最終ジャッジ日時 2023-09-02 05:01:33
合計ジャッジ時間 6,241 ms
ジャッジサーバーID
(参考情報)
judge12 / judge16
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 WA -
testcase_21 RE -
testcase_22 WA -
testcase_23 WA -
testcase_24 RE -
testcase_25 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

def query(x):
    print('?',x,  flush = True)
    ret = int(input())
    return ret


n = int(input())
left = 1
right = n

while abs(right - left) > 1:
    now = (left + right) // 2
    ret = query(now)
    if 2 * ret - now > 0:
        left = now
    elif 2 * ret - now < 0:
        right = now
    else:
        print('!', 1,  now, flush = True)
0