結果

問題 No.1830 Balanced Majority
ユーザー ShirotsumeShirotsume
提出日時 2022-02-04 22:18:27
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 362 bytes
コンパイル時間 1,284 ms
コンパイル使用メモリ 87,156 KB
実行使用メモリ 87,868 KB
平均クエリ数 11.38
最終ジャッジ日時 2023-09-02 05:01:44
合計ジャッジ時間 4,650 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 91 ms
87,136 KB
testcase_02 AC 91 ms
87,400 KB
testcase_03 AC 92 ms
86,944 KB
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 AC 92 ms
87,564 KB
testcase_13 AC 95 ms
87,496 KB
testcase_14 AC 94 ms
87,792 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 93 ms
87,304 KB
testcase_18 AC 93 ms
87,236 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 94 ms
86,988 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 98 ms
87,116 KB
testcase_25 AC 96 ms
87,372 KB
権限があれば一括ダウンロードができます

ソースコード

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)
        break
0