1521D — Nastia Plays with a Tree

Правка en1, от Neeki, 2024-06-29 16:46:33

I tried a greedy solution forthis problem:
if there exist a pair of adjacent vertices like (u,v) such that deg(u)>=3 and deg(v)>=3, then remove the edge between u and v.
Then, if there exist a pair of adjacent vertices like (u,v) such that deg(u)>=3 and deg(v)>=2, then remove the edge between u and v.

Then, if there exist a pair of adjacent vertices like (u,v) such that deg(u)>=3 and deg(v)>=1, then remove the edge between u and v.
At last, I add edges between the leaves of different components .
Why it is not correct??

submission

Теги 1521d, graph, problem

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский Neeki 2024-06-29 16:53:13 7 Tiny change: 'br>\nWhy it is not correct?' -> 'br>\nWhy isn't it correct?'
en2 Английский Neeki 2024-06-29 16:51:36 82 Tiny change: ' $deg(u)>=3$ and $de' -> ' $deg(u)>=\geq3$ and $de' (published)
en1 Английский Neeki 2024-06-29 16:46:33 722 Initial revision (saved to drafts)