結果

問題 No.2346 Replace!!
ユーザー satou
提出日時 2023-06-09 23:35:54
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 307 bytes
コンパイル時間 347 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 11,264 KB
最終ジャッジ日時 2025-01-02 05:44:24
合計ジャッジ時間 4,696 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 36 WA * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

T=int(input())

for i in range(T):
	N=int(input())
	A=list(map(int,input().split()))
	B=list(map(int,input().split()))
	
	cnt=0
	for j in range(N):
		if A[j]!=B[j]:
			#print(i,A[A[j]])
			if A[A[j]-1]!=B[j]:
					if B[A[j]-1]!=B[j]:
						cnt+=1
			#else:
		#		A[j]=B[j]
	print("Yes" if cnt==0 else "No")
	
0