結果

問題 No.1610 She Loves Me, She Loves Me Not, ...
ユーザー m1k__m1k__
提出日時 2021-07-21 21:31:57
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 604 bytes
コンパイル時間 315 ms
コンパイル使用メモリ 87,216 KB
実行使用メモリ 79,340 KB
最終ジャッジ日時 2023-09-24 15:32:27
合計ジャッジ時間 6,319 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
71,808 KB
testcase_01 AC 102 ms
77,156 KB
testcase_02 AC 96 ms
71,552 KB
testcase_03 AC 92 ms
71,728 KB
testcase_04 WA -
testcase_05 AC 170 ms
78,528 KB
testcase_06 AC 165 ms
78,912 KB
testcase_07 WA -
testcase_08 AC 174 ms
79,280 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 166 ms
78,824 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 124 ms
77,176 KB
testcase_17 AC 123 ms
77,296 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 126 ms
77,320 KB
testcase_21 WA -
testcase_22 AC 123 ms
77,192 KB
testcase_23 AC 95 ms
71,308 KB
testcase_24 AC 111 ms
77,536 KB
testcase_25 AC 95 ms
71,732 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 119 ms
77,548 KB
testcase_30 AC 114 ms
77,196 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 121 ms
77,252 KB
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = [int(x) for x in input().split()]
from_cnt = [0]*N
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)
    from_cnt[b] += 1
    from_cnt[a] += 1

s = set()
from collections import deque
q = deque([v for v in range(N) if from_cnt[v]>0])
cnt = from_cnt[::]
n = 0
ans = 0
while q and n < 10**5:
    n += 1
    v = q.popleft()
    for u in to[v]:
        if cnt[u]==0: continue
        if cnt[u]%2:
            ans ^= 1
            cnt[u] -= 1
            cnt[v] -= 1
        q.append(u)
print('Yes' if ans else 'No')
0