結果

問題 No.1610 She Loves Me, She Loves Me Not, ...
ユーザー m1k__m1k__
提出日時 2021-07-21 21:57:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 194 ms / 2,000 ms
コード長 709 bytes
コンパイル時間 421 ms
コンパイル使用メモリ 87,112 KB
実行使用メモリ 106,020 KB
最終ジャッジ日時 2023-09-24 17:20:34
合計ジャッジ時間 5,549 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,476 KB
testcase_01 AC 73 ms
76,604 KB
testcase_02 AC 70 ms
71,412 KB
testcase_03 AC 69 ms
71,300 KB
testcase_04 AC 68 ms
71,320 KB
testcase_05 AC 188 ms
80,908 KB
testcase_06 AC 166 ms
92,616 KB
testcase_07 AC 150 ms
79,964 KB
testcase_08 AC 194 ms
106,020 KB
testcase_09 AC 160 ms
82,940 KB
testcase_10 AC 178 ms
99,012 KB
testcase_11 AC 157 ms
80,212 KB
testcase_12 AC 162 ms
80,324 KB
testcase_13 AC 157 ms
79,908 KB
testcase_14 AC 83 ms
75,536 KB
testcase_15 AC 82 ms
75,492 KB
testcase_16 AC 81 ms
75,288 KB
testcase_17 AC 81 ms
75,332 KB
testcase_18 AC 79 ms
75,348 KB
testcase_19 AC 79 ms
75,312 KB
testcase_20 AC 80 ms
75,244 KB
testcase_21 AC 80 ms
75,368 KB
testcase_22 AC 80 ms
75,288 KB
testcase_23 AC 71 ms
71,360 KB
testcase_24 AC 70 ms
71,568 KB
testcase_25 AC 70 ms
71,544 KB
testcase_26 AC 70 ms
71,464 KB
testcase_27 AC 71 ms
71,340 KB
testcase_28 AC 73 ms
71,244 KB
testcase_29 AC 71 ms
71,364 KB
testcase_30 AC 71 ms
71,340 KB
testcase_31 AC 71 ms
71,264 KB
testcase_32 AC 70 ms
71,320 KB
testcase_33 AC 71 ms
71,620 KB
testcase_34 AC 70 ms
71,344 KB
testcase_35 AC 71 ms
71,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = [int(x) for x in input().split()]
to = [[]*N for _ in range(N)]
for _ in range(M):
    a, b = [int(x)-1 for x in input().split()]
    to[a].append(b)
    to[b].append(a)

lst = []
loop = [0]*N
visited = [0]*N
def dfs(v, p=-1):
    if visited[v]: return
    visited[v] = 1
    for u in to[v]:
        if u == p: continue
        if u in lst:
            b = lst.index(u)
            for x in lst[b:]:
                loop[x] = 1
        else:
            lst.append(u)
            dfs(u, v)
            lst.pop()

for i in range(N):
    lst.append(i)
    dfs(i)
    lst.pop()
cnt = 0
for v in range(N):
    for u in to[v]:
        cnt += loop[v] and loop[u]
cnt //= 2
print('Yes' if (M-cnt)%2 else 'No')
0