結果

問題 No.1610 She Loves Me, She Loves Me Not, ...
ユーザー wolgnikwolgnik
提出日時 2021-07-21 21:29:21
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 230 ms / 2,000 ms
コード長 600 bytes
コンパイル時間 387 ms
コンパイル使用メモリ 87,044 KB
実行使用メモリ 79,820 KB
最終ジャッジ日時 2023-09-24 15:23:37
合計ジャッジ時間 5,990 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
71,008 KB
testcase_01 AC 119 ms
77,648 KB
testcase_02 AC 84 ms
71,148 KB
testcase_03 AC 76 ms
71,232 KB
testcase_04 AC 79 ms
71,296 KB
testcase_05 AC 230 ms
79,820 KB
testcase_06 AC 188 ms
79,708 KB
testcase_07 AC 187 ms
79,740 KB
testcase_08 AC 181 ms
78,892 KB
testcase_09 AC 181 ms
79,220 KB
testcase_10 AC 182 ms
79,020 KB
testcase_11 AC 189 ms
79,568 KB
testcase_12 AC 175 ms
79,372 KB
testcase_13 AC 180 ms
79,616 KB
testcase_14 AC 82 ms
75,536 KB
testcase_15 AC 81 ms
75,516 KB
testcase_16 AC 85 ms
75,708 KB
testcase_17 AC 85 ms
75,744 KB
testcase_18 AC 85 ms
75,612 KB
testcase_19 AC 86 ms
75,600 KB
testcase_20 AC 85 ms
75,800 KB
testcase_21 AC 86 ms
75,784 KB
testcase_22 AC 83 ms
75,496 KB
testcase_23 AC 74 ms
71,340 KB
testcase_24 AC 75 ms
71,228 KB
testcase_25 AC 75 ms
71,280 KB
testcase_26 AC 75 ms
71,188 KB
testcase_27 AC 76 ms
71,268 KB
testcase_28 AC 74 ms
71,212 KB
testcase_29 AC 74 ms
71,328 KB
testcase_30 AC 77 ms
71,216 KB
testcase_31 AC 77 ms
71,384 KB
testcase_32 AC 78 ms
71,180 KB
testcase_33 AC 76 ms
71,008 KB
testcase_34 AC 76 ms
71,280 KB
testcase_35 AC 77 ms
71,268 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
N, M = map(int, input().split())
e = [[] for _ in range(N + 1)]
inc = [0] * (N + 1)
for _ in range(M):
  u, v = map(int, input().split())
  e[u].append(v)
  e[v].append(u)
  inc[u] += 1
  inc[v] += 1

import heapq
hpush = heapq.heappush
hpop = heapq.heappop
h = []
for x in range(1, N + 1):
  hpush(h, (inc[x], x))
res = 0

while len(h):
  c, x = hpop(h)
  if inc[x] != c:
    hpush(h, (inc[x], x))
    continue
  if c != 1: continue
  for y in e[x]:
    inc[y] -= 1
    hpush(h, (inc[y], y))
  inc[x] = 0
  res += 1
  
if res & 1: print("Yes")
else: print("No")
0