結果
| 問題 | No.583 鉄道同好会 |
| コンテスト | |
| ユーザー |
Bioinfo_K
|
| 提出日時 | 2017-10-28 10:33:05 |
| 言語 | Python3 (3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 733 bytes |
| 記録 | |
| コンパイル時間 | 64 ms |
| コンパイル使用メモリ | 14,976 KB |
| 実行使用メモリ | 19,840 KB |
| 最終ジャッジ日時 | 2026-10-14 19:01:21 |
| 合計ジャッジ時間 | 6,640 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 WA * 1 TLE * 1 -- * 7 |
ソースコード
import sys,collections
sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()
n,m = Is()
mat = [[] for _ in range(n)]
for _ in range(m):
a,b = Is()
mat[a].append(b)
mat[b].append(a)
visited = [False]*(n)
l = 0
def DFS(v,p,d):
visited[v] = True
for e in mat[v]:
if e != p and d<=m:
DFS(e, v,d+1)
DFS(0,0,0)
odd = 0
for i,e in enumerate(mat):
if len(e) > 0:
if visited[i] == False:
print("NO")
exit()
elif len(e) % 2 == 1:
odd += 1
if odd <= 2:
print("YES")
else:
print("NO")
Bioinfo_K