結果

問題 No.1610 She Loves Me, She Loves Me Not, ...
ユーザー O2MTO2MT
提出日時 2021-07-21 22:42:24
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 582 bytes
コンパイル時間 1,104 ms
コンパイル使用メモリ 87,008 KB
実行使用メモリ 276,436 KB
最終ジャッジ日時 2023-09-24 18:58:44
合計ジャッジ時間 11,305 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
71,536 KB
testcase_01 AC 577 ms
273,724 KB
testcase_02 AC 97 ms
71,628 KB
testcase_03 AC 94 ms
71,620 KB
testcase_04 AC 97 ms
71,792 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 626 ms
275,928 KB
testcase_09 AC 630 ms
276,012 KB
testcase_10 AC 620 ms
275,964 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 103 ms
72,960 KB
testcase_15 AC 101 ms
73,216 KB
testcase_16 WA -
testcase_17 AC 105 ms
72,932 KB
testcase_18 AC 103 ms
72,972 KB
testcase_19 AC 102 ms
73,016 KB
testcase_20 WA -
testcase_21 AC 101 ms
73,032 KB
testcase_22 AC 107 ms
72,948 KB
testcase_23 AC 97 ms
71,772 KB
testcase_24 AC 94 ms
71,736 KB
testcase_25 AC 94 ms
71,584 KB
testcase_26 AC 92 ms
71,792 KB
testcase_27 AC 95 ms
71,612 KB
testcase_28 AC 93 ms
71,604 KB
testcase_29 AC 94 ms
71,592 KB
testcase_30 AC 96 ms
71,620 KB
testcase_31 AC 94 ms
71,748 KB
testcase_32 AC 94 ms
71,796 KB
testcase_33 AC 95 ms
71,724 KB
testcase_34 AC 95 ms
71,744 KB
testcase_35 AC 94 ms
71,512 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)

num = 0

for i in range(N):
  if len(l[i]) > 1:
    continue
  que = deque([i])
  while que:
    v = que.pop()
    if len(l[v]) > 2:
      continue
    for vv in l[v]:
      if not visited[v][vv]:
        que.append(vv)
        visited[v][vv] = True
        visited[vv][v] = True
        num += 1

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