結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
71,340 KB
testcase_01 AC 102 ms
77,044 KB
testcase_02 AC 95 ms
71,696 KB
testcase_03 AC 94 ms
71,496 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 355 ms
137,624 KB
testcase_08 WA -
testcase_09 AC 368 ms
138,956 KB
testcase_10 AC 302 ms
122,708 KB
testcase_11 AC 302 ms
123,012 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 312 ms
161,656 KB
testcase_17 AC 310 ms
162,224 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 308 ms
162,028 KB
testcase_21 WA -
testcase_22 AC 309 ms
161,184 KB
testcase_23 AC 95 ms
71,684 KB
testcase_24 AC 196 ms
117,776 KB
testcase_25 AC 93 ms
71,704 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 247 ms
118,004 KB
testcase_30 AC 266 ms
145,368 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 315 ms
166,752 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**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