結果
問題 |
No.850 企業コンテスト2位
|
ユーザー |
![]() |
提出日時 | 2019-07-12 16:57:26 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,235 bytes |
コンパイル時間 | 189 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 27,992 KB |
平均クエリ数 | 200.11 |
最終ジャッジ日時 | 2024-07-16 17:48:32 |
合計ジャッジ時間 | 8,776 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | WA * 27 |
ソースコード
N=int(input()) TOURNAMENT=[list(range(1,N+1))] WINLIST=[] while len(TOURNAMENT[-1])!=1: LEN=len(TOURNAMENT[-1]) NEXT=[] for i in range(0,LEN,2): if i==LEN-1: NEXT.append(TOURNAMENT[-1][i]) break x=TOURNAMENT[-1][i] y=TOURNAMENT[-1][i+1] print("?",x,y,flush=True) win=int(input()) if x==win: NEXT.append(x) WINLIST.append([x,y]) else: NEXT.append(y) WINLIST.append([y,x]) TOURNAMENT.extend([NEXT]) WIN1=TOURNAMENT[-1][-1] TOURNAMENT2=[] for x,y in WINLIST: if x==WIN1: TOURNAMENT2.append(y) TOURNAMENT=[TOURNAMENT2] while len(TOURNAMENT[-1])!=1: LEN=len(TOURNAMENT[-1]) NEXT=[] for i in range(0,LEN,2): if i==LEN-1: NEXT.append(TOURNAMENT[-1][i]) break x=TOURNAMENT[-1][i] y=TOURNAMENT[-1][i+1] print("?",x,y,flush=True) win=int(input()) if x==win: NEXT.append(x) WINLIST.append([x,y]) else: NEXT.append(y) WINLIST.append([y,x]) TOURNAMENT.extend([NEXT]) print(TOURNAMENT[-1][-1])