結果
| 問題 | No.2664 Prime Sum |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-08 21:07:36 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 627 bytes |
| 記録 | |
| コンパイル時間 | 199 ms |
| コンパイル使用メモリ | 85,068 KB |
| 実行使用メモリ | 67,820 KB |
| 最終ジャッジ日時 | 2026-04-16 02:20:32 |
| 合計ジャッジ時間 | 4,570 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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')