結果

問題 No.1610 She Loves Me, She Loves Me Not, ...
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-07-21 22:04:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 152 ms / 2,000 ms
コード長 463 bytes
コンパイル時間 574 ms
コンパイル使用メモリ 86,996 KB
実行使用メモリ 79,136 KB
最終ジャッジ日時 2023-09-24 17:41:14
合計ジャッジ時間 5,671 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,456 KB
testcase_01 AC 89 ms
75,692 KB
testcase_02 AC 72 ms
71,536 KB
testcase_03 AC 73 ms
71,140 KB
testcase_04 AC 74 ms
71,296 KB
testcase_05 AC 145 ms
78,040 KB
testcase_06 AC 138 ms
78,188 KB
testcase_07 AC 152 ms
79,136 KB
testcase_08 AC 149 ms
78,908 KB
testcase_09 AC 147 ms
78,936 KB
testcase_10 AC 151 ms
78,720 KB
testcase_11 AC 137 ms
78,224 KB
testcase_12 AC 146 ms
78,876 KB
testcase_13 AC 142 ms
78,044 KB
testcase_14 AC 80 ms
71,460 KB
testcase_15 AC 81 ms
71,136 KB
testcase_16 AC 79 ms
71,320 KB
testcase_17 AC 81 ms
71,260 KB
testcase_18 AC 83 ms
71,276 KB
testcase_19 AC 81 ms
71,128 KB
testcase_20 AC 81 ms
70,992 KB
testcase_21 AC 82 ms
71,592 KB
testcase_22 AC 81 ms
71,428 KB
testcase_23 AC 72 ms
71,324 KB
testcase_24 AC 73 ms
71,328 KB
testcase_25 AC 74 ms
71,420 KB
testcase_26 AC 71 ms
71,516 KB
testcase_27 AC 73 ms
71,332 KB
testcase_28 AC 74 ms
71,348 KB
testcase_29 AC 73 ms
71,512 KB
testcase_30 AC 74 ms
71,312 KB
testcase_31 AC 75 ms
71,284 KB
testcase_32 AC 74 ms
70,980 KB
testcase_33 AC 74 ms
71,140 KB
testcase_34 AC 75 ms
71,340 KB
testcase_35 AC 73 ms
71,428 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
G = [[] for i in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1; b -= 1
    G[a].append(b); G[b].append(a)
visit = [0] * n
ans = 0
def dfs(v):
    global ans
    cnt = sum(visit[i] for i in G[v])
    if len(G[v]) - cnt != 1: return 
    visit[v] = 1
    ans += 1
    for u in G[v]:
        if not visit[u]: dfs(u)
for i in range(n):
    if len(G[i]) == 1:
        dfs(i)
print(["No", "Yes"][ans % 2])
0