結果

問題 No.850 企業コンテスト2位
コンテスト
ユーザー mkawa2
提出日時 2022-03-11 10:52:18
言語 Python3
(3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 473 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 303 ms
コンパイル使用メモリ 21,412 KB
実行使用メモリ 15,868 KB
平均クエリ数 197.50
最終ジャッジ日時 2026-08-27 23:03:56
合計ジャッジ時間 7,310 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 3 WA * 24
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def ask(i, j):
    print("?", i+1, j+1, flush=True)
    return int(input())-1

def tournament(now):
    lose = [[] for _ in range(n)]
    while len(now) > 1:
        win = []
        for i, j in zip(now[::2], now[1::2]):
            w = ask(i, j)
            lose[w].append(i ^ j ^ w)
            win.append(w)
        now = win
    return now[0], lose

n = int(input())

top, lose = tournament(list(range(n)))
ans, _ = tournament(lose[top])

print("!", ans+1, flush=True)
0