結果
| 問題 |
No.583 鉄道同好会
|
| コンテスト | |
| ユーザー |
lllllll88938494
|
| 提出日時 | 2022-09-17 13:14:21 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 521 bytes |
| コンパイル時間 | 307 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 80,768 KB |
| 最終ジャッジ日時 | 2024-12-22 00:43:05 |
| 合計ジャッジ時間 | 3,287 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 16 |
ソースコード
n,m=map(int,input().split())
stations = [[] for i in range(n)]
ans =[0]*n
for i in range(m):
a,b=map(int,input().split())
stations[a].append(b)
stations[b].append(a)
ans[a] = 1
ans[b] = 1
if i == 0:start = a
cnt=0
for i in stations:
if len(i)%2 == 1:
cnt+=1
f=[0]*n
def dfs(x):
for i in stations[x]:
if f[i] == 0:
f[i] = 1
dfs(i)
f[start] = 1
dfs(start)
if (f == ans) and (cnt == 0 or cnt == 2):
print('Yes')
else:
print('No')
lllllll88938494