結果

問題 No.2948 move move rotti
ユーザー aa
提出日時 2024-10-25 22:41:08
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 474 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 82,356 KB
実行使用メモリ 54,428 KB
最終ジャッジ日時 2024-10-25 22:41:11
合計ジャッジ時間 2,664 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m,k=map(int,input().split())
x=list(map(int,input().split()))
a=[[] for i in range(n)]
for i in range(m):
	s,t=map(int,input().split())
	a[s-1].append(t-1)
	a[t-1].append(s-1)
y=[0 for i in range(n)]
now={x[0]-1}
used={x[0]-1}
c=1 
while now:
	new=set()
	for i in now:
		for j in a[i]:
			if j not in used:
				new.add(j)
				used.add(j)
				y[j]=c
	now=new
	c+=1
for i in x:
	if i-1 not in used:
		print('No')
		exit()
	if y[i-1]%2!=0:
		print('No')
		exit()
print('Yes')
0