Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

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

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

Merry Christmas Everyone!

A problem from Div2 (237) C. Restore Graph asks to construct a graph when distances from a vertex are given.

The solutions and editorial to this problem indicate that we should be searching for nodes that are at dist[u] + 1 for a given node u and there should at least be one such node. But if we have distances = [0, 1, 4], then a tree like this 1-(1)->2-(3)->3 also satisfies the conditions in the question and there is no node at a distance of 2 from 1. Can anyone please help he understand what am I missing here?

Thanks in advance!

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

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

The graph is unweighted my dude