結果
問題 |
No.2948 move move rotti
|
ユーザー |
![]() |
提出日時 | 2024-07-03 05:09:51 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 610 bytes |
コンパイル時間 | 84 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-07-03 05:51:51 |
合計ジャッジ時間 | 5,777 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | TLE * 1 -- * 27 |
ソースコード
import sys sys.setrecursionlimit(100000) n,m,k=map(int,input().split()) x=set(map(lambda a:int(a)-1,input().split())) con=[[] for _ in range(n)] for i in range(m): u,v=map(int,input().split()) con[u-1].append(v-1) con[v-1].append(u-1) possible=[set() for _ in range(n)] visited=set() def dfs(now): #if now in possible[len(visited)]:return possible[len(visited)].add(now) visited.add(now) for nex in con[now]: if nex not in visited: dfs(nex) visited.remove(now) for i in range(n): dfs(i) for j in possible: if x<=j: print("Yes") exit() possible=[set() for _ in range(n)] print("No")