結果

問題 No.1830 Balanced Majority
ユーザー Shirotsume
提出日時 2022-02-04 22:18:27
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 362 bytes
コンパイル時間 185 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 69,080 KB
平均クエリ数 11.38
最終ジャッジ日時 2024-06-11 12:01:18
合計ジャッジ時間 3,107 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 10 WA * 15
権限があれば一括ダウンロードができます

ソースコード

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