結果

問題 No.1610 She Loves Me, She Loves Me Not, ...
ユーザー convexineq
提出日時 2021-07-23 09:33:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 94 ms / 2,000 ms
コード長 424 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 77,696 KB
最終ジャッジ日時 2024-07-18 06:10:52
合計ジャッジ時間 3,156 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
g = [[] for _ in range(n)]
deg = [0]*n
for i in range(m):
    a,b = map(int,input().split())
    g[a-1].append((b-1,i))
    g[b-1].append((a-1,i))
    deg[a-1] += 1
    deg[b-1] += 1
q = [i for i in range(n) if deg[i]==1]
used = [0]*m
for v in q:
    for c,i in g[v]:
        used[i] = 1
        deg[c] -= 1
        if deg[c] == 1:
            q.append(c)
print("Yes" if sum(used)%2 else "No")
0