結果

問題 No.1610 She Loves Me, She Loves Me Not, ...
ユーザー lloyzlloyz
提出日時 2021-12-30 12:39:39
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 53 ms / 2,000 ms
コード長 698 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 12,032 KB
最終ジャッジ日時 2024-04-15 20:12:23
合計ジャッジ時間 2,305 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,880 KB
testcase_01 AC 28 ms
10,880 KB
testcase_02 AC 28 ms
10,880 KB
testcase_03 AC 28 ms
10,880 KB
testcase_04 AC 27 ms
10,880 KB
testcase_05 AC 50 ms
12,032 KB
testcase_06 AC 52 ms
11,904 KB
testcase_07 AC 51 ms
11,904 KB
testcase_08 AC 51 ms
11,904 KB
testcase_09 AC 52 ms
12,032 KB
testcase_10 AC 52 ms
11,904 KB
testcase_11 AC 51 ms
12,032 KB
testcase_12 AC 53 ms
11,904 KB
testcase_13 AC 52 ms
12,032 KB
testcase_14 AC 31 ms
10,880 KB
testcase_15 AC 30 ms
10,880 KB
testcase_16 AC 29 ms
10,880 KB
testcase_17 AC 31 ms
10,880 KB
testcase_18 AC 30 ms
10,880 KB
testcase_19 AC 31 ms
10,880 KB
testcase_20 AC 31 ms
10,880 KB
testcase_21 AC 31 ms
10,880 KB
testcase_22 AC 30 ms
10,880 KB
testcase_23 AC 29 ms
10,880 KB
testcase_24 AC 29 ms
10,880 KB
testcase_25 AC 28 ms
10,880 KB
testcase_26 AC 28 ms
10,880 KB
testcase_27 AC 27 ms
10,880 KB
testcase_28 AC 28 ms
10,880 KB
testcase_29 AC 29 ms
10,880 KB
testcase_30 AC 28 ms
10,880 KB
testcase_31 AC 28 ms
10,880 KB
testcase_32 AC 27 ms
10,880 KB
testcase_33 AC 29 ms
10,880 KB
testcase_34 AC 28 ms
10,880 KB
testcase_35 AC 28 ms
10,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict, deque

n, m = map(int, input().split())
edge = defaultdict(list)
V = [0 for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    edge[a].append(b)
    edge[b].append(a)
    V[a] += 1
    V[b] += 1

Que = deque()
for i in range(n):
    if V[i] == 1:
        Que.append(i)

cnt = 0
while Que:
    curr = Que.popleft()
    if V[curr] >= 1:
        cnt += 1
        V[curr] -= 1
        for np in edge[curr]:
            if V[np] >= 1:
                V[np] -= 1
                if V[np] == 1:
                    Que.append(np)

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