結果
| 問題 | No.1610 She Loves Me, She Loves Me Not, ... | 
| コンテスト | |
| ユーザー | 👑  Kazun | 
| 提出日時 | 2021-07-21 21:28:50 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 112 ms / 2,000 ms | 
| コード長 | 501 bytes | 
| コンパイル時間 | 179 ms | 
| コンパイル使用メモリ | 82,304 KB | 
| 実行使用メモリ | 77,728 KB | 
| 最終ジャッジ日時 | 2024-07-17 16:05:49 | 
| 合計ジャッジ時間 | 3,391 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 32 | 
ソースコード
from collections import deque
N,M=map(int,input().split())
E=[[] for _ in range(N+1)]
D=[0]*(N+1)
for _ in range(M):
    a,b=map(int,input().split())
    E[a].append(b)
    E[b].append(a)
    D[a]+=1; D[b]+=1
X=[0]*(N+1)
Q=deque([x for x in range(N+1) if D[x]==1])
while Q:
    x=Q.popleft()
    if X[x]==1 or D[x]!=1:
        continue
    X[x]=1
    for y in E[x]:
        D[x]=0
        D[y]-=1
        if D[y]==1 and X[y]==0:
            Q.append(y)
print("Yes" if sum(X)%2==1 else "No")
            
            
            
        