結果

問題 No.1610 She Loves Me, She Loves Me Not, ...
ユーザー m1k__
提出日時 2021-07-21 21:33:07
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 604 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 181,504 KB
最終ジャッジ日時 2024-07-17 16:23:30
合計ジャッジ時間 9,070 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 15 WA * 17
権限があれば一括ダウンロードができます

ソースコード

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**6:
    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