結果

問題 No.3400 Nana's Plus Permutation Game (7 + 7) ÷ 7
コンテスト
ユーザー Sinonen
提出日時 2024-10-21 21:44:15
言語 PyPy3
(7.3.15)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 521 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 174 ms
コンパイル使用メモリ 82,844 KB
実行使用メモリ 85,024 KB
平均クエリ数 2.00
最終ジャッジ日時 2025-12-06 23:30:49
合計ジャッジ時間 16,119 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 31 RE * 46
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from collections import defaultdict,deque
N=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=0
  path[k].append(i)
  path[i].append(k)

Q=deque()
now=0
Q.append(0)
check=set()
check.add(0)

while len(Q)>0:
	p=Q.popleft()
	now=p
	for j in path[p]:
		if j not in check:
			check.add(j)
			Q.append(j)
			
ans=[0]*(N+1)
ans[now]=1
one=now
for i in range(1,N):
	print(1,one,now,flush=True)
	k=int(input())
	ans[k],now=i+1,k
ans[0]=2
print(*ans,flush=True)
0