Изменения рейтингов за последние раунды временно удалены. Скоро они будут возвращены. ×

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

Автор kingofnumbers, 13 лет назад, По-английски

Hi when I was trying to understand the solution for 293E - Близкие вершины by reading AC codes.

I was reading this code 3689358 , but I can't understand the way he stores the tree.

for me I usually use adjecency list to store graphs or trees.

can you tell about this way to store the tree.

thanks for helping.

edit: is it Euler tour? if yes how is way that the code build the Euler tour?

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

»
13 лет назад, скрыть # |
 
Проголосовать: нравится +13 Проголосовать: не нравится

It's adjacency one-linked lists. head[v] is id of the first edge adjacent to v, next[e] is id of next edge. Look at for in dfs — it should make sense.