結果

問題 No.1610 She Loves Me, She Loves Me Not, ...
ユーザー 👑 KazunKazun
提出日時 2021-07-21 21:28:50
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 143 ms / 2,000 ms
コード長 501 bytes
コンパイル時間 514 ms
コンパイル使用メモリ 86,984 KB
実行使用メモリ 78,800 KB
最終ジャッジ日時 2023-09-24 15:19:58
合計ジャッジ時間 5,986 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
71,188 KB
testcase_01 AC 101 ms
76,568 KB
testcase_02 AC 93 ms
71,580 KB
testcase_03 AC 94 ms
71,468 KB
testcase_04 AC 94 ms
71,628 KB
testcase_05 AC 143 ms
78,756 KB
testcase_06 AC 139 ms
78,648 KB
testcase_07 AC 141 ms
78,380 KB
testcase_08 AC 142 ms
78,604 KB
testcase_09 AC 139 ms
78,668 KB
testcase_10 AC 140 ms
78,800 KB
testcase_11 AC 143 ms
78,700 KB
testcase_12 AC 141 ms
78,764 KB
testcase_13 AC 137 ms
78,796 KB
testcase_14 AC 100 ms
72,300 KB
testcase_15 AC 101 ms
72,340 KB
testcase_16 AC 101 ms
72,280 KB
testcase_17 AC 100 ms
72,292 KB
testcase_18 AC 101 ms
72,288 KB
testcase_19 AC 101 ms
72,288 KB
testcase_20 AC 103 ms
72,472 KB
testcase_21 AC 100 ms
72,288 KB
testcase_22 AC 100 ms
72,144 KB
testcase_23 AC 93 ms
71,476 KB
testcase_24 AC 94 ms
71,704 KB
testcase_25 AC 93 ms
71,452 KB
testcase_26 AC 93 ms
71,500 KB
testcase_27 AC 93 ms
71,624 KB
testcase_28 AC 92 ms
71,528 KB
testcase_29 AC 93 ms
71,320 KB
testcase_30 AC 93 ms
71,692 KB
testcase_31 AC 94 ms
71,664 KB
testcase_32 AC 94 ms
71,308 KB
testcase_33 AC 94 ms
71,452 KB
testcase_34 AC 95 ms
71,524 KB
testcase_35 AC 95 ms
71,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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")
0