結果

問題 No.1610 She Loves Me, She Loves Me Not, ...
ユーザー ntudantuda
提出日時 2021-09-06 18:13:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 513 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 87,224 KB
実行使用メモリ 78,460 KB
最終ジャッジ日時 2023-08-24 05:37:03
合計ジャッジ時間 5,485 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,440 KB
testcase_01 AC 76 ms
76,232 KB
testcase_02 AC 73 ms
71,320 KB
testcase_03 AC 73 ms
71,464 KB
testcase_04 AC 73 ms
71,288 KB
testcase_05 AC 124 ms
78,216 KB
testcase_06 AC 123 ms
78,284 KB
testcase_07 AC 122 ms
78,324 KB
testcase_08 AC 122 ms
78,404 KB
testcase_09 AC 123 ms
78,460 KB
testcase_10 AC 121 ms
78,324 KB
testcase_11 AC 122 ms
78,328 KB
testcase_12 AC 120 ms
78,460 KB
testcase_13 AC 123 ms
78,296 KB
testcase_14 AC 82 ms
71,444 KB
testcase_15 AC 79 ms
71,360 KB
testcase_16 AC 78 ms
71,368 KB
testcase_17 AC 78 ms
71,268 KB
testcase_18 AC 81 ms
71,532 KB
testcase_19 AC 79 ms
71,048 KB
testcase_20 AC 78 ms
71,360 KB
testcase_21 AC 80 ms
71,288 KB
testcase_22 AC 85 ms
71,396 KB
testcase_23 AC 73 ms
71,156 KB
testcase_24 AC 72 ms
71,588 KB
testcase_25 AC 72 ms
71,604 KB
testcase_26 AC 71 ms
71,048 KB
testcase_27 AC 72 ms
71,324 KB
testcase_28 AC 71 ms
71,556 KB
testcase_29 AC 71 ms
71,448 KB
testcase_30 AC 73 ms
71,352 KB
testcase_31 AC 73 ms
71,248 KB
testcase_32 AC 73 ms
71,288 KB
testcase_33 AC 73 ms
71,396 KB
testcase_34 AC 71 ms
71,560 KB
testcase_35 AC 73 ms
71,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(M)]

E =[[] for _ in range(N+1)]
for a,b in AB:
    E[a].append(b)
    E[b].append(a)

L = set()
for i in range(1,N+1):
    if len(E[i]) == 1 and not(E[i][0] in L):
        L.add(i)

cnt = 0
while len(L) > 0:
    cnt += 1
    a = next(iter((L)))
    L.remove(a)
    b = E[a][0]
    E[a].remove(b)
    E[b].remove(a)
    if len(E[b]) == 1 and (len(E[E[b][0]])!=1):
        L.add(b)

if cnt % 2 == 1: print("Yes")
else: print("No")
0