結果
問題 |
No.2910 単体ホモロジー入門
|
ユーザー |
![]() |
提出日時 | 2024-10-11 22:53:43 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,260 bytes |
コンパイル時間 | 933 ms |
コンパイル使用メモリ | 82,332 KB |
実行使用メモリ | 67,396 KB |
最終ジャッジ日時 | 2024-10-11 22:53:48 |
合計ジャッジ時間 | 4,795 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | RE * 47 |
ソースコード
from collections import deque, defaultdict, Counter from bisect import bisect_left, bisect_right from atcoder.fenwicktree import FenwickTree from atcoder.segtree import SegTree from atcoder.lazysegtree import LazySegTree from atcoder.dsu import DSU from atcoder.scc import SCCGraph from atcoder.string import suffix_array from itertools import permutations, combinations from functools import cmp_to_key, cache from more_itertools import distinct_permutations from heapq import heappop, heappush import math, sys import pypyjit pypyjit.set_param('max_unroll_recursion=-1') sys.setrecursionlimit(10**7) _int = lambda x: int(x)-1 MOD = 998244353 INF = 1<<62 Yes, No = "Yes", "No" N, M = map(int, input().split()) E = defaultdict(list) for _ in range(M): u, v = map(int, input().split()) E[u].append(v) E[v].append(u) S = set(list(map(int, input().split()))) stack = [] memo = [0]*N def dfs(i, parent): for j in E[i]: if j == parent: continue stack.append(j) if memo[j]: end = stack[-1] T = set(stack[stack.index(end):]) print(Yes if T != S else No) exit() memo[j] = 1 dfs(j, i) memo[j] = 0 stack.pop() stack.append(0) memo[0] = 1 dfs(0, -1)