結果

問題 No.1610 She Loves Me, She Loves Me Not, ...
ユーザー KudeKude
提出日時 2021-07-21 21:25:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 513 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 86,860 KB
実行使用メモリ 78,212 KB
最終ジャッジ日時 2023-09-24 15:13:13
合計ジャッジ時間 4,825 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,236 KB
testcase_01 AC 76 ms
75,572 KB
testcase_02 AC 71 ms
71,336 KB
testcase_03 AC 72 ms
71,088 KB
testcase_04 AC 71 ms
71,340 KB
testcase_05 AC 119 ms
78,036 KB
testcase_06 AC 115 ms
77,996 KB
testcase_07 AC 117 ms
78,212 KB
testcase_08 AC 117 ms
78,184 KB
testcase_09 AC 119 ms
78,060 KB
testcase_10 AC 116 ms
77,908 KB
testcase_11 AC 116 ms
77,920 KB
testcase_12 AC 115 ms
77,820 KB
testcase_13 AC 118 ms
77,968 KB
testcase_14 AC 77 ms
71,256 KB
testcase_15 AC 77 ms
71,176 KB
testcase_16 AC 78 ms
71,080 KB
testcase_17 AC 78 ms
71,180 KB
testcase_18 AC 78 ms
71,076 KB
testcase_19 AC 77 ms
71,412 KB
testcase_20 AC 77 ms
71,360 KB
testcase_21 AC 77 ms
71,296 KB
testcase_22 AC 78 ms
71,332 KB
testcase_23 AC 71 ms
71,288 KB
testcase_24 AC 71 ms
71,380 KB
testcase_25 AC 71 ms
71,008 KB
testcase_26 AC 70 ms
71,184 KB
testcase_27 AC 71 ms
71,408 KB
testcase_28 AC 71 ms
71,056 KB
testcase_29 AC 73 ms
71,012 KB
testcase_30 AC 75 ms
71,352 KB
testcase_31 AC 72 ms
71,112 KB
testcase_32 AC 74 ms
71,244 KB
testcase_33 AC 72 ms
71,168 KB
testcase_34 AC 72 ms
71,400 KB
testcase_35 AC 74 ms
71,356 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

cnt = 0
todo = []
for i in range(n):
    if deg[i] == 1:
        todo.append(i)

while todo:
    u = todo.pop()
    if deg[u] != 1:
        continue
    cnt += 1
    for v in to[u]:
        deg[v] -= 1
        if deg[v] == 1:
            todo.append(v)

print('Yes' if cnt % 2 else 'No')
0