結果

問題 No.1610 She Loves Me, She Loves Me Not, ...
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-07-21 21:45:19
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 463 bytes
コンパイル時間 385 ms
コンパイル使用メモリ 86,948 KB
実行使用メモリ 79,260 KB
最終ジャッジ日時 2023-09-24 16:28:30
合計ジャッジ時間 5,702 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
70,868 KB
testcase_01 AC 76 ms
75,148 KB
testcase_02 AC 81 ms
71,044 KB
testcase_03 AC 73 ms
71,036 KB
testcase_04 AC 73 ms
71,016 KB
testcase_05 AC 152 ms
78,248 KB
testcase_06 WA -
testcase_07 AC 144 ms
78,172 KB
testcase_08 WA -
testcase_09 AC 140 ms
77,832 KB
testcase_10 WA -
testcase_11 AC 139 ms
77,972 KB
testcase_12 WA -
testcase_13 AC 152 ms
78,444 KB
testcase_14 WA -
testcase_15 AC 80 ms
71,028 KB
testcase_16 WA -
testcase_17 AC 80 ms
70,944 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 78 ms
71,112 KB
testcase_21 AC 78 ms
70,844 KB
testcase_22 AC 78 ms
70,712 KB
testcase_23 AC 71 ms
70,912 KB
testcase_24 AC 72 ms
71,024 KB
testcase_25 AC 73 ms
70,904 KB
testcase_26 AC 73 ms
71,084 KB
testcase_27 AC 74 ms
71,020 KB
testcase_28 AC 74 ms
71,100 KB
testcase_29 AC 75 ms
70,940 KB
testcase_30 AC 74 ms
70,944 KB
testcase_31 AC 75 ms
71,100 KB
testcase_32 AC 74 ms
71,020 KB
testcase_33 AC 73 ms
71,096 KB
testcase_34 AC 74 ms
70,940 KB
testcase_35 AC 73 ms
71,016 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):
    visit[v] = 1
    global ans
    cnt = sum(visit[i] for i in G[v])
    if len(G[v]) - cnt != 1: return 
    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