結果
問題 |
No.1610 She Loves Me, She Loves Me Not, ...
|
ユーザー |
|
提出日時 | 2021-12-30 12:27:06 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 666 bytes |
コンパイル時間 | 167 ms |
コンパイル使用メモリ | 12,928 KB |
実行使用メモリ | 12,928 KB |
最終ジャッジ日時 | 2024-10-05 23:52:45 |
合計ジャッジ時間 | 2,792 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 WA * 11 |
ソースコード
from collections import defaultdict, deque n, m = map(int, input().split()) edge = defaultdict(list) V = [0 for _ in range(n)] for _ in range(m): a, b = map(int, input().split()) a -= 1 b -= 1 edge[a].append(b) edge[b].append(a) V[a] += 1 V[b] += 1 Que = deque() seen = set() for i in range(n): if V[i] == 1: Que.append(i) while Que: curr = Que.popleft() seen.add(curr) for np in edge[curr]: V[np] -= 1 if V[np] == 0: seen.add(np) elif V[np] == 1: Que.append(np) if seen == set(range(n)): print("Yes") else: print("No")