結果

問題 No.1610 She Loves Me, She Loves Me Not, ...
ユーザー 👑 rin204rin204
提出日時 2021-12-13 01:38:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 132 ms / 2,000 ms
コード長 621 bytes
コンパイル時間 335 ms
コンパイル使用メモリ 87,284 KB
実行使用メモリ 78,128 KB
最終ジャッジ日時 2023-09-28 20:26:56
合計ジャッジ時間 6,005 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,304 KB
testcase_01 AC 80 ms
75,604 KB
testcase_02 AC 74 ms
71,196 KB
testcase_03 AC 77 ms
71,148 KB
testcase_04 AC 77 ms
71,128 KB
testcase_05 AC 132 ms
77,828 KB
testcase_06 AC 120 ms
78,100 KB
testcase_07 AC 118 ms
77,876 KB
testcase_08 AC 117 ms
78,128 KB
testcase_09 AC 120 ms
77,752 KB
testcase_10 AC 120 ms
77,980 KB
testcase_11 AC 119 ms
77,892 KB
testcase_12 AC 119 ms
77,868 KB
testcase_13 AC 120 ms
77,832 KB
testcase_14 AC 82 ms
71,212 KB
testcase_15 AC 84 ms
71,164 KB
testcase_16 AC 85 ms
71,168 KB
testcase_17 AC 81 ms
71,160 KB
testcase_18 AC 81 ms
71,016 KB
testcase_19 AC 81 ms
71,092 KB
testcase_20 AC 82 ms
71,356 KB
testcase_21 AC 82 ms
71,080 KB
testcase_22 AC 81 ms
71,024 KB
testcase_23 AC 76 ms
71,016 KB
testcase_24 AC 76 ms
71,356 KB
testcase_25 AC 76 ms
71,180 KB
testcase_26 AC 75 ms
71,028 KB
testcase_27 AC 76 ms
71,380 KB
testcase_28 AC 76 ms
70,872 KB
testcase_29 AC 77 ms
71,284 KB
testcase_30 AC 77 ms
71,352 KB
testcase_31 AC 78 ms
71,356 KB
testcase_32 AC 77 ms
71,352 KB
testcase_33 AC 77 ms
71,088 KB
testcase_34 AC 78 ms
71,404 KB
testcase_35 AC 76 ms
71,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
cnt = [0] * n
edges = [[] for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    cnt[a] += 1
    cnt[b] += 1
    edges[a].append(b)
    edges[b].append(a)
    
stack = []
for i in range(n):
    if cnt[i] == 1:
        stack.append(i)

ans = False
while stack:
    pos = stack.pop()
    if cnt[pos] == 1:
        ans ^= True
        cnt[pos] -= 1
    else:
        continue
    
    for npos in edges[pos]:
        cnt[npos] -= 1
        if cnt[npos] == 1:
            stack.append(npos)
        
if ans:
    print("Yes")
else:
    print("No")
0