結果
| 問題 | No.583 鉄道同好会 |
| コンテスト | |
| ユーザー |
lllllll88938494
|
| 提出日時 | 2022-09-17 13:14:21 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 521 bytes |
| 記録 | |
| コンパイル時間 | 277 ms |
| コンパイル使用メモリ | 85,632 KB |
| 実行使用メモリ | 86,272 KB |
| 最終ジャッジ日時 | 2026-05-28 11:46:50 |
| 合計ジャッジ時間 | 2,800 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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