結果

問題 No.1610 She Loves Me, She Loves Me Not, ...
ユーザー shotoyooshotoyoo
提出日時 2021-07-21 21:25:23
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 111 ms / 2,000 ms
コード長 872 bytes
コンパイル時間 2,294 ms
コンパイル使用メモリ 86,464 KB
実行使用メモリ 78,240 KB
最終ジャッジ日時 2023-09-24 15:12:31
合計ジャッジ時間 4,776 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,192 KB
testcase_01 AC 78 ms
75,656 KB
testcase_02 AC 73 ms
71,320 KB
testcase_03 AC 75 ms
71,332 KB
testcase_04 AC 73 ms
71,208 KB
testcase_05 AC 111 ms
77,932 KB
testcase_06 AC 107 ms
77,852 KB
testcase_07 AC 101 ms
76,868 KB
testcase_08 AC 99 ms
76,748 KB
testcase_09 AC 100 ms
77,304 KB
testcase_10 AC 106 ms
77,908 KB
testcase_11 AC 105 ms
78,240 KB
testcase_12 AC 102 ms
76,772 KB
testcase_13 AC 100 ms
76,628 KB
testcase_14 AC 76 ms
71,236 KB
testcase_15 AC 74 ms
71,236 KB
testcase_16 AC 76 ms
71,108 KB
testcase_17 AC 76 ms
71,284 KB
testcase_18 AC 75 ms
71,036 KB
testcase_19 AC 77 ms
71,188 KB
testcase_20 AC 77 ms
71,228 KB
testcase_21 AC 75 ms
71,236 KB
testcase_22 AC 75 ms
71,304 KB
testcase_23 AC 71 ms
71,068 KB
testcase_24 AC 71 ms
71,240 KB
testcase_25 AC 72 ms
71,004 KB
testcase_26 AC 73 ms
71,376 KB
testcase_27 AC 72 ms
71,328 KB
testcase_28 AC 73 ms
71,264 KB
testcase_29 AC 74 ms
71,380 KB
testcase_30 AC 73 ms
71,344 KB
testcase_31 AC 72 ms
71,284 KB
testcase_32 AC 73 ms
71,116 KB
testcase_33 AC 73 ms
71,236 KB
testcase_34 AC 71 ms
71,380 KB
testcase_35 AC 72 ms
71,328 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda : sys.stdin.readline().rstrip()

sys.setrecursionlimit(2*10**5+10)
write = lambda x: sys.stdout.write(x+"\n")
debug = lambda x: sys.stderr.write(x+"\n")
writef = lambda x: print("{:.12f}".format(x))


# グラフの読み込み
n,m = map(int, input().split())
ns = [[] for _ in range(n)]
ds = [0]*n
for _ in range(m):
    u,v = map(int, input().split())
    u -= 1
    v -= 1
    ns[u].append(v)
    ns[v].append(u)
    ds[u] += 1
    ds[v] += 1

done = [0]*n
ng = [0]*n    
q = []
for u in range(n):
    if ds[u]==1:
        q.append(u)
        done[u] = 1
val = 0
while q:
    u = q.pop()
    if not ng[u]:
        val += 1
    for v in ns[u]:
        ds[v] -= 1
        if ds[v]==1 and (not done[v]):
            q.append(v)
            done[v] = 1
        if ds[v]==0:
            ng[v] = 1
if val%2==0:
    print("No")
else:
    print("Yes")
0