結果
問題 | No.1610 She Loves Me, She Loves Me Not, ... |
ユーザー |
![]() |
提出日時 | 2022-02-12 22:18:45 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 89 ms / 2,000 ms |
コード長 | 561 bytes |
コンパイル時間 | 152 ms |
コンパイル使用メモリ | 82,532 KB |
実行使用メモリ | 77,648 KB |
最終ジャッジ日時 | 2024-06-29 01:32:33 |
合計ジャッジ時間 | 3,488 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 32 |
ソースコード
# https://yukicoder.me/problems/no/1610# No.1610 She Loves Me, She Loves Me Not, ...n, m = map(int, input().split())AB = [list(map(int, input().split())) for _ in range(m)]graph = [[] for _ in range(n)]for a, b in AB:a -= 1b -= 1graph[a].append(b)graph[b].append(a)cnt = 0flg = Truewhile flg:flg = Falsefor i in range(n):if len(graph[i]) == 1:flg = Truecnt += 1nxt = graph[i].pop()graph[nxt].remove(i)if cnt % 2 == 1:print("Yes")else:print("No")