結果
| 問題 |
No.850 企業コンテスト2位
|
| コンテスト | |
| ユーザー |
mkawa2
|
| 提出日時 | 2022-03-11 10:55:44 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 65 ms / 2,000 ms |
| コード長 | 518 bytes |
| コンパイル時間 | 402 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 27,528 KB |
| 平均クエリ数 | 200.11 |
| 最終ジャッジ日時 | 2024-09-15 10:55:19 |
| 合計ジャッジ時間 | 3,762 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 27 |
ソースコード
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)
mkawa2