結果

問題 No.1610 She Loves Me, She Loves Me Not, ...
ユーザー hir355hir355
提出日時 2021-07-21 21:33:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 555 bytes
コンパイル時間 835 ms
コンパイル使用メモリ 86,748 KB
実行使用メモリ 78,184 KB
最終ジャッジ日時 2023-09-24 15:37:02
合計ジャッジ時間 4,980 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
70,948 KB
testcase_01 AC 76 ms
75,496 KB
testcase_02 AC 73 ms
71,352 KB
testcase_03 AC 72 ms
71,308 KB
testcase_04 AC 71 ms
70,680 KB
testcase_05 AC 124 ms
77,772 KB
testcase_06 AC 119 ms
78,048 KB
testcase_07 AC 117 ms
78,164 KB
testcase_08 AC 121 ms
77,988 KB
testcase_09 AC 116 ms
77,768 KB
testcase_10 AC 116 ms
77,960 KB
testcase_11 AC 116 ms
77,880 KB
testcase_12 AC 114 ms
78,036 KB
testcase_13 AC 116 ms
78,184 KB
testcase_14 AC 79 ms
71,020 KB
testcase_15 AC 77 ms
70,884 KB
testcase_16 AC 79 ms
70,984 KB
testcase_17 AC 78 ms
71,400 KB
testcase_18 AC 78 ms
71,104 KB
testcase_19 AC 78 ms
70,748 KB
testcase_20 AC 77 ms
71,116 KB
testcase_21 AC 78 ms
70,928 KB
testcase_22 AC 79 ms
71,052 KB
testcase_23 AC 71 ms
71,196 KB
testcase_24 AC 71 ms
70,744 KB
testcase_25 AC 72 ms
71,196 KB
testcase_26 AC 70 ms
71,096 KB
testcase_27 AC 71 ms
70,752 KB
testcase_28 AC 71 ms
70,748 KB
testcase_29 AC 71 ms
71,344 KB
testcase_30 AC 70 ms
71,356 KB
testcase_31 AC 69 ms
70,748 KB
testcase_32 AC 71 ms
71,276 KB
testcase_33 AC 72 ms
71,048 KB
testcase_34 AC 71 ms
70,980 KB
testcase_35 AC 71 ms
71,324 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
g = [[] for _ in range(n)]
inv = [0] * n
for _ in range(m):
    a, b = map(int, input().split())
    g[a - 1].append(b - 1)
    g[b - 1].append(a - 1)
    inv[a - 1] += 1
    inv[b - 1] += 1
s = []
for i in range(n):
    if inv[i] == 1:
        s.append(i)
ans = 0
d = [1] * n
while s:
    v = s.pop()
    d[v] = 0
    for node in g[v]:
        if d[node]:
            ans += 1
            inv[node] -= 1
            if inv[node] == 1:
                s.append(node)
if ans % 2 == 1:
    print('Yes')
else:
    print('No')
0