結果

問題 No.1610 She Loves Me, She Loves Me Not, ...
ユーザー ayaoniayaoni
提出日時 2021-07-21 21:42:43
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 1,011 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 86,988 KB
実行使用メモリ 78,124 KB
最終ジャッジ日時 2023-09-24 16:15:53
合計ジャッジ時間 5,738 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
71,536 KB
testcase_01 AC 112 ms
77,032 KB
testcase_02 AC 93 ms
71,640 KB
testcase_03 AC 92 ms
71,432 KB
testcase_04 AC 90 ms
71,548 KB
testcase_05 AC 126 ms
77,972 KB
testcase_06 AC 124 ms
78,068 KB
testcase_07 AC 123 ms
77,972 KB
testcase_08 AC 124 ms
78,112 KB
testcase_09 AC 127 ms
78,124 KB
testcase_10 AC 124 ms
77,864 KB
testcase_11 AC 122 ms
78,068 KB
testcase_12 AC 120 ms
77,836 KB
testcase_13 AC 124 ms
78,080 KB
testcase_14 AC 96 ms
72,484 KB
testcase_15 AC 97 ms
72,172 KB
testcase_16 AC 94 ms
72,156 KB
testcase_17 AC 98 ms
72,060 KB
testcase_18 AC 96 ms
72,064 KB
testcase_19 AC 99 ms
72,036 KB
testcase_20 AC 99 ms
72,200 KB
testcase_21 AC 97 ms
72,360 KB
testcase_22 AC 97 ms
72,196 KB
testcase_23 AC 94 ms
71,640 KB
testcase_24 AC 94 ms
71,712 KB
testcase_25 AC 94 ms
71,512 KB
testcase_26 AC 95 ms
71,472 KB
testcase_27 AC 92 ms
71,752 KB
testcase_28 AC 93 ms
71,512 KB
testcase_29 AC 94 ms
71,268 KB
testcase_30 AC 96 ms
71,532 KB
testcase_31 AC 94 ms
71,596 KB
testcase_32 AC 93 ms
71,292 KB
testcase_33 AC 94 ms
71,512 KB
testcase_34 AC 94 ms
71,612 KB
testcase_35 AC 95 ms
71,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import deque
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())


N,M = MI()
Graph = [[] for _ in range(N+1)]
for _ in range(M):
    A,B = MI()
    Graph[A].append(B)
    Graph[B].append(A)

deg = [len(Graph[i]) for i in range(N+1)]
deq = deque([])
for i in range(1,N+1):
    if deg[i] == 1:
        deq.append(i)

flag = [0]*(N+1)
ans = 0
while deq:
    i = deq.pop()
    if flag[i] or deg[i] != 1:
        continue
    flag[i] = 1
    ans += 1
    for j in Graph[i]:
        deg[j] -= 1
        if deg[j] == 1:
            deq.append(j)

if ans % 2 == 1:
    print('Yes')
else:
    print('No')
0