結果
問題 |
No.2664 Prime Sum
|
ユーザー |
|
提出日時 | 2024-03-08 21:07:36 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 627 bytes |
コンパイル時間 | 240 ms |
コンパイル使用メモリ | 82,124 KB |
実行使用メモリ | 67,116 KB |
最終ジャッジ日時 | 2024-09-29 18:50:51 |
合計ジャッジ時間 | 2,993 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 34 WA * 3 |
ソースコード
import sys, time, random from collections import deque, Counter, defaultdict input = lambda: sys.stdin.readline().rstrip() ii = lambda: int(input()) mi = lambda: map(int, input().split()) li = lambda: list(mi()) inf = 2 ** 61 - 1 mod = 998244353 n, m = mi() graph = [[] for _ in range(n)] for _ in range(m): a, b = mi() graph[a - 1].append(b - 1) graph[b - 1].append(a - 1) # is bipartite color = [-1] * n def dfs(v, c): color[v] = c for u in graph[v]: if color[u] == -1: dfs(u, c ^ 1) elif color[u] == c: print('No') exit() dfs(0, 0) print('Yes')