結果

問題 No.1610 She Loves Me, She Loves Me Not, ...
ユーザー O2MTO2MT
提出日時 2021-07-21 22:51:22
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 652 ms / 2,000 ms
コード長 672 bytes
コンパイル時間 1,090 ms
コンパイル使用メモリ 86,860 KB
実行使用メモリ 275,920 KB
最終ジャッジ日時 2023-09-24 19:11:41
合計ジャッジ時間 12,267 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
71,348 KB
testcase_01 AC 590 ms
273,532 KB
testcase_02 AC 101 ms
71,696 KB
testcase_03 AC 101 ms
71,732 KB
testcase_04 AC 99 ms
71,352 KB
testcase_05 AC 646 ms
275,788 KB
testcase_06 AC 643 ms
275,732 KB
testcase_07 AC 644 ms
275,740 KB
testcase_08 AC 647 ms
275,740 KB
testcase_09 AC 649 ms
275,920 KB
testcase_10 AC 652 ms
275,700 KB
testcase_11 AC 652 ms
275,528 KB
testcase_12 AC 642 ms
275,816 KB
testcase_13 AC 638 ms
275,704 KB
testcase_14 AC 103 ms
72,992 KB
testcase_15 AC 107 ms
72,740 KB
testcase_16 AC 104 ms
73,108 KB
testcase_17 AC 103 ms
72,912 KB
testcase_18 AC 105 ms
72,856 KB
testcase_19 AC 104 ms
72,816 KB
testcase_20 AC 102 ms
72,840 KB
testcase_21 AC 102 ms
72,992 KB
testcase_22 AC 101 ms
72,928 KB
testcase_23 AC 92 ms
71,608 KB
testcase_24 AC 95 ms
71,704 KB
testcase_25 AC 91 ms
71,628 KB
testcase_26 AC 91 ms
71,720 KB
testcase_27 AC 91 ms
71,696 KB
testcase_28 AC 92 ms
71,480 KB
testcase_29 AC 91 ms
71,564 KB
testcase_30 AC 93 ms
71,432 KB
testcase_31 AC 92 ms
71,464 KB
testcase_32 AC 93 ms
71,596 KB
testcase_33 AC 93 ms
71,560 KB
testcase_34 AC 93 ms
71,596 KB
testcase_35 AC 91 ms
71,248 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()
    c = 0
    for vv in l[v]:
      if visited[v][vv] or visited[vv][v]:
        c += 1
    if len(l[v])-c > 1:
      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