NZEC in diameter of tree

Правка en1, от Mark_Stark1, 2020-09-01 10:28:19

I tried solving the diameter of a tree (not necessarily a binary tree) problem in python 3.0. I created a adjacency list and ran dfs on the tree storing the maximum two heights of the sub-tree and the maximum diameter encountered so far. I think my logic is pretty correct, but I can't seem to find a problem with the code. It gave a memory limit exceeded error in PyPy and a runtime error in python. Problem:https://codeforces.me/gym/102694/problem/A My Solution:91533595

Теги nzec, diameter, tree, python, pypy

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский Mark_Stark1 2020-09-01 10:28:19 512 Initial revision (published)