結果
問題 |
No.583 鉄道同好会
|
ユーザー |
|
提出日時 | 2019-08-04 20:09:07 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 470 bytes |
コンパイル時間 | 431 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 17,792 KB |
最終ジャッジ日時 | 2024-07-16 01:29:47 |
合計ジャッジ時間 | 3,165 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 WA * 1 |
ソースコード
from collections import defaultdict N, M = map(int, input().split()) adj_dict = defaultdict(list) for _ in range(M): Sa_i, Sb_i = map(int, input().split()) adj_dict[Sa_i].append(Sb_i) adj_dict[Sb_i].append(Sa_i) degree_even, degree_odd = 0, 0 for node in adj_dict: d = len(adj_dict[node]) if d % 2 == 0: degree_even += 1 else: degree_odd += 1 if degree_odd == 0 or degree_odd == 2: print('YES') else: print('NO')