結果
問題 | No.1610 She Loves Me, She Loves Me Not, ... |
ユーザー |
![]() |
提出日時 | 2021-07-21 21:25:38 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 105 ms / 2,000 ms |
コード長 | 513 bytes |
コンパイル時間 | 368 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 77,184 KB |
最終ジャッジ日時 | 2024-07-17 15:58:50 |
合計ジャッジ時間 | 3,488 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 32 |
ソースコード
n, m = map(int, input().split()) deg = [0] * n to = [[] for _ in range(n)] for _ in range(m): a, b = map(int, input().split()) a -= 1 b -= 1 to[a].append(b) to[b].append(a) deg[a] += 1 deg[b] += 1 cnt = 0 todo = [] for i in range(n): if deg[i] == 1: todo.append(i) while todo: u = todo.pop() if deg[u] != 1: continue cnt += 1 for v in to[u]: deg[v] -= 1 if deg[v] == 1: todo.append(v) print('Yes' if cnt % 2 else 'No')