結果
問題 | No.2967 Nana's Plus Permutation Game |
ユーザー |
|
提出日時 | 2024-10-21 22:05:19 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 804 ms / 2,000 ms |
コード長 | 521 bytes |
コンパイル時間 | 395 ms |
コンパイル使用メモリ | 82,976 KB |
実行使用メモリ | 95,804 KB |
平均クエリ数 | 4170.09 |
最終ジャッジ日時 | 2024-10-26 00:54:14 |
合計ジャッジ時間 | 35,931 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 65 |
ソースコード
from collections import defaultdict,dequeN=int(input())path=defaultdict(list)for i in range(1,N+1):print(1,i,i,flush=True)k=int(input())if k==-1:k=0path[k].append(i)path[i].append(k)Q=deque()now=0Q.append(0)check=set()check.add(0)while len(Q)>0:p=Q.popleft()now=pfor j in path[p]:if j not in check:check.add(j)Q.append(j)ans=[0]*(N+1)ans[now]=1one=nowfor i in range(1,N):print(1,one,now,flush=True)k=int(input())ans[k],now=i+1,kans[0]=2print(*ans,flush=True)