結果

問題 No.1610 She Loves Me, She Loves Me Not, ...
ユーザー 👑 tamatotamato
提出日時 2021-07-21 21:27:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 918 bytes
コンパイル時間 876 ms
コンパイル使用メモリ 87,372 KB
実行使用メモリ 78,344 KB
最終ジャッジ日時 2023-09-24 15:16:07
合計ジャッジ時間 6,062 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
72,016 KB
testcase_01 AC 96 ms
76,800 KB
testcase_02 AC 94 ms
71,596 KB
testcase_03 AC 95 ms
71,972 KB
testcase_04 AC 96 ms
71,688 KB
testcase_05 AC 123 ms
78,328 KB
testcase_06 AC 123 ms
78,112 KB
testcase_07 AC 122 ms
77,956 KB
testcase_08 AC 120 ms
78,316 KB
testcase_09 AC 123 ms
78,344 KB
testcase_10 AC 123 ms
78,264 KB
testcase_11 AC 122 ms
78,312 KB
testcase_12 AC 122 ms
78,336 KB
testcase_13 AC 124 ms
78,096 KB
testcase_14 AC 97 ms
71,864 KB
testcase_15 AC 96 ms
72,132 KB
testcase_16 AC 92 ms
71,996 KB
testcase_17 AC 92 ms
71,936 KB
testcase_18 AC 91 ms
71,972 KB
testcase_19 AC 92 ms
71,972 KB
testcase_20 AC 93 ms
71,908 KB
testcase_21 AC 97 ms
71,820 KB
testcase_22 AC 96 ms
71,976 KB
testcase_23 AC 95 ms
72,000 KB
testcase_24 AC 94 ms
71,972 KB
testcase_25 AC 92 ms
72,052 KB
testcase_26 AC 90 ms
71,656 KB
testcase_27 AC 90 ms
71,832 KB
testcase_28 AC 91 ms
71,956 KB
testcase_29 AC 92 ms
71,984 KB
testcase_30 AC 96 ms
71,980 KB
testcase_31 AC 92 ms
71,980 KB
testcase_32 AC 91 ms
72,044 KB
testcase_33 AC 91 ms
71,832 KB
testcase_34 AC 91 ms
71,844 KB
testcase_35 AC 91 ms
71,948 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    from collections import deque
    input = sys.stdin.readline

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

    que = deque()
    cnt = 0
    for v in range(1, N+1):
        if deg[v] == 1:
            que.append(v)
    seen = [0] * (N+1)
    while que:
        v = que.popleft()
        seen[v] = 1
        cnt += 1
        flg = 0
        for u in adj[v]:
            if not seen[u]:
                deg[u] -= 1
                if deg[u] == 1:
                    que.append(u)
                flg = 1
        if not flg:
            cnt -= 1
    if cnt & 1:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()
0