結果

問題 No.1830 Balanced Majority
コンテスト
ユーザー tnodino
提出日時 2022-02-04 21:50:17
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 306 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 399 ms
コンパイル使用メモリ 20,828 KB
実行使用メモリ 34,692 KB
平均クエリ数 2.65
最終ジャッジ日時 2026-03-04 12:57:52
合計ジャッジ時間 4,765 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 9 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
def Question(K):
    print(f'? {K}')
    sys.stdout.flush()
    return int(input())

def Answer(L, R):
    print(f'! {L} {R}')
    sys.stdout.flush()
    exit()

N = int(input())
M = N // 2 - 1
if Question(M * 2) == M:
    Answer(1, M * 1)
if Question(2) == 1:
    Answer(3, N)
Answer(2, N - 1)
0