結果
問題 | No.1610 She Loves Me, She Loves Me Not, ... |
ユーザー |
![]() |
提出日時 | 2024-08-09 05:58:53 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 49 ms / 2,000 ms |
コード長 | 526 bytes |
コンパイル時間 | 485 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,648 KB |
最終ジャッジ日時 | 2024-08-09 05:58:56 |
合計ジャッジ時間 | 3,125 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 32 |
ソースコード
N,M=map(int,input().split())graph=[[] for x in range(N)]degree=[0]*Nfor m in range(M):a,b=map(int,input().split())a-=1;b-=1graph[a].append(b)graph[b].append(a)degree[a]+=1degree[b]+=1queue=[]for x in range(N):if degree[x]==1:queue.append(x)cnt=0while queue:x=queue.pop()if degree[x]!=1:continuecnt+=1for y in graph[x]:degree[y]-=1if degree[y]==1:queue.append(y)if cnt%2:ans="Yes"else:ans="No"print(ans)