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

Difficulty interpreting question C. Restore Graph

Правка en3, от et__fpme__, 2020-12-25 13:36:48

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!

Теги #graph, unable to understand

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en4 Английский et__fpme__ 2020-12-25 13:37:10 11 Tiny change: '\n\nThanks!' -> '\n\nThanks in advance!'
en3 Английский et__fpme__ 2020-12-25 13:36:48 26 Tiny change: 'Hi,\n\nA prob' -> 'Merry Christmas Everyone!\n\nA prob'
en2 Английский et__fpme__ 2020-12-25 13:35:52 55 Tiny change: 'at are at dist[u] + 1 for a giv' -> 'at are at ~~~~dist[u] + 1~~~~ for a giv'
en1 Английский et__fpme__ 2020-12-25 13:31:20 623 Initial revision (published)