結果

問題 No.1610 She Loves Me, She Loves Me Not, ...
ユーザー H20
提出日時 2021-07-25 22:53:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 98 ms / 2,000 ms
コード長 606 bytes
コンパイル時間 560 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 77,696 KB
最終ジャッジ日時 2024-07-21 07:19:32
合計ジャッジ時間 3,639 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections
N,M = map(int, input().split())
L = [[]  for i in range(N)]
CNT = [0]*N
for _ in range(M):
    a,b = map(int, input().split())
    a-=1
    b-=1
    L[a].append(b)
    L[b].append(a)
    CNT[a]+=1
    CNT[b]+=1

d = collections.deque()
for i in range(N):
    if CNT[i]==1:
        d.append(i)
cut = 0
while len(d):
    i = d.popleft()
    CNT[i]-=1
    flag = False
    for l in L[i]:
        if CNT[l]>0:
            flag = True
            CNT[l]-=1
            if CNT[l]==1:
                d.append(l)
    if flag:
        cut+=1


if cut%2==1:
    print('Yes')
else:
    print('No')
0