結果

問題 No.1610 She Loves Me, She Loves Me Not, ...
ユーザー m1k__m1k__
提出日時 2021-07-21 22:40:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 142 ms / 2,000 ms
コード長 529 bytes
コンパイル時間 1,327 ms
コンパイル使用メモリ 87,032 KB
実行使用メモリ 79,056 KB
最終ジャッジ日時 2023-09-24 18:57:43
合計ジャッジ時間 5,829 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
71,644 KB
testcase_01 AC 95 ms
77,244 KB
testcase_02 AC 89 ms
71,632 KB
testcase_03 AC 87 ms
71,644 KB
testcase_04 AC 87 ms
71,692 KB
testcase_05 AC 142 ms
78,900 KB
testcase_06 AC 141 ms
79,028 KB
testcase_07 AC 140 ms
78,704 KB
testcase_08 AC 139 ms
79,056 KB
testcase_09 AC 139 ms
78,916 KB
testcase_10 AC 138 ms
78,924 KB
testcase_11 AC 139 ms
78,912 KB
testcase_12 AC 136 ms
78,940 KB
testcase_13 AC 140 ms
78,708 KB
testcase_14 AC 96 ms
72,176 KB
testcase_15 AC 95 ms
72,148 KB
testcase_16 AC 97 ms
72,272 KB
testcase_17 AC 95 ms
72,132 KB
testcase_18 AC 96 ms
72,240 KB
testcase_19 AC 95 ms
71,932 KB
testcase_20 AC 96 ms
72,420 KB
testcase_21 AC 98 ms
72,472 KB
testcase_22 AC 99 ms
72,288 KB
testcase_23 AC 87 ms
71,872 KB
testcase_24 AC 86 ms
71,676 KB
testcase_25 AC 85 ms
71,440 KB
testcase_26 AC 90 ms
71,680 KB
testcase_27 AC 87 ms
71,568 KB
testcase_28 AC 91 ms
71,708 KB
testcase_29 AC 90 ms
71,588 KB
testcase_30 AC 91 ms
71,848 KB
testcase_31 AC 88 ms
71,740 KB
testcase_32 AC 89 ms
71,768 KB
testcase_33 AC 87 ms
71,720 KB
testcase_34 AC 84 ms
71,656 KB
testcase_35 AC 85 ms
71,364 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = [int(x) for x in input().split()]
deg = [0]*N
to = [[]*N for _ in range(N)]
for _ in range(M):
    a, b = [int(x)-1 for x in input().split()]
    to[a].append(b)
    to[b].append(a)
    deg[a] += 1
    deg[b] += 1

from collections import deque
q = deque([v for v in range(N) if deg[v]==1])
ans = 0
while q:
    v = q.popleft()
    if deg[v]==0: continue
    deg[v] -= 1
    for u in to[v]:
        if deg[u]==0: continue
        ans ^= 1
        deg[u] -= 1
        if deg[u]==1: q.append(u)
print('Yes' if ans else 'No')
0