結果

問題 No.850 企業コンテスト2位
ユーザー mkawa2mkawa2
提出日時 2022-03-11 10:55:44
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 52 ms / 2,000 ms
コード長 518 bytes
コンパイル時間 101 ms
コンパイル使用メモリ 10,820 KB
実行使用メモリ 24,408 KB
平均クエリ数 200.11
最終ジャッジ日時 2023-10-13 14:07:29
合計ジャッジ時間 3,349 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
24,396 KB
testcase_01 AC 39 ms
24,396 KB
testcase_02 AC 38 ms
24,408 KB
testcase_03 AC 39 ms
23,556 KB
testcase_04 AC 38 ms
23,844 KB
testcase_05 AC 39 ms
24,048 KB
testcase_06 AC 41 ms
23,556 KB
testcase_07 AC 44 ms
24,372 KB
testcase_08 AC 45 ms
24,024 KB
testcase_09 AC 45 ms
23,404 KB
testcase_10 AC 52 ms
24,024 KB
testcase_11 AC 50 ms
23,684 KB
testcase_12 AC 51 ms
24,396 KB
testcase_13 AC 51 ms
23,628 KB
testcase_14 AC 51 ms
23,500 KB
testcase_15 AC 51 ms
24,060 KB
testcase_16 AC 50 ms
23,856 KB
testcase_17 AC 51 ms
23,436 KB
testcase_18 AC 51 ms
23,844 KB
testcase_19 AC 51 ms
23,648 KB
testcase_20 AC 52 ms
23,456 KB
testcase_21 AC 52 ms
24,048 KB
testcase_22 AC 52 ms
23,768 KB
testcase_23 AC 52 ms
23,844 KB
testcase_24 AC 52 ms
23,584 KB
testcase_25 AC 52 ms
24,036 KB
testcase_26 AC 52 ms
24,312 KB
testcase_27 AC 38 ms
24,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
        if len(now) & 1: win.append(now[-1])
        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