結果

問題 No.1610 She Loves Me, She Loves Me Not, ...
ユーザー O2MTO2MT
提出日時 2021-07-21 22:02:57
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 572 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 86,964 KB
実行使用メモリ 275,876 KB
最終ジャッジ日時 2023-09-24 17:37:28
合計ジャッジ時間 10,781 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
71,640 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 612 ms
275,760 KB
testcase_08 AC 613 ms
275,764 KB
testcase_09 WA -
testcase_10 AC 596 ms
275,704 KB
testcase_11 WA -
testcase_12 AC 609 ms
275,716 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 108 ms
77,852 KB
testcase_17 WA -
testcase_18 AC 105 ms
77,708 KB
testcase_19 WA -
testcase_20 AC 109 ms
77,732 KB
testcase_21 WA -
testcase_22 AC 106 ms
77,636 KB
testcase_23 AC 91 ms
71,672 KB
testcase_24 AC 92 ms
71,316 KB
testcase_25 AC 92 ms
71,440 KB
testcase_26 AC 89 ms
71,668 KB
testcase_27 AC 91 ms
71,780 KB
testcase_28 AC 89 ms
71,448 KB
testcase_29 AC 91 ms
71,620 KB
testcase_30 AC 91 ms
71,528 KB
testcase_31 AC 88 ms
71,608 KB
testcase_32 AC 90 ms
71,492 KB
testcase_33 AC 90 ms
71,772 KB
testcase_34 AC 90 ms
71,376 KB
testcase_35 AC 90 ms
71,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

N,M = map(int,input().split())
l = [[] for _ in range(N)]
visited = [[False]*N for _ in range(N)]

for _ in range(M):
  a,b = map(int,input().split())
  a -= 1
  b -= 1
  l[a].append(b)
  l[b].append(a)

INF = 10**18
G = [0 for _ in range(N)]
c = -1

for i in range(N):
  if G[i] == 0:
    c += 1
  que = deque([i])
  while que:
    v = que.popleft()
    for vv in l[v]:
      if not visited[v][vv]:
        G[v] += 1
        que.append(vv)
        visited[v][vv] = True

num = G.count(1)+c

if num%2 != 0:
  print('Yes')
else:
  print('No')
0