Блог пользователя Mark_Stark1

Автор Mark_Stark1, история, 4 года назад, По-английски

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

Полный текст и комментарии »

  • Проголосовать: нравится
  • -11
  • Проголосовать: не нравится