結果
問題 | No.2202 贅沢てりたまチキン |
ユーザー |
![]() |
提出日時 | 2025-03-20 21:11:19 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 224 ms / 2,000 ms |
コード長 | 961 bytes |
コンパイル時間 | 147 ms |
コンパイル使用メモリ | 82,524 KB |
実行使用メモリ | 106,400 KB |
最終ジャッジ日時 | 2025-03-20 21:11:35 |
合計ジャッジ時間 | 3,954 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 |
ソースコード
import sysfrom collections import dequen, m = map(int, sys.stdin.readline().split())adj = [[] for _ in range(n + 1)]for _ in range(m):a, b = map(int, sys.stdin.readline().split())adj[a].append(b)adj[b].append(a)color = [-1] * (n + 1)for u in range(1, n + 1):if color[u] == -1:queue = deque([u])color[u] = 0is_bipart = Truefound_conflict = Falsewhile queue and not found_conflict:v = queue.popleft()for nei in adj[v]:if color[nei] == -1:color[nei] = 1 - color[v]queue.append(nei)else:if color[nei] == color[v]:found_conflict = Trueis_bipart = Falsebreakif found_conflict:breakif is_bipart:print("No")sys.exit()print("Yes")