1521D — Nastia Plays with a Tree

Revision en1, by Mhn_Neek, 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

Tags 1521d, graph, problem

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English Mhn_Neek 2024-06-29 16:53:13 7 Tiny change: 'br>\nWhy it is not correct?' -> 'br>\nWhy isn't it correct?'
en2 English Mhn_Neek 2024-06-29 16:51:36 82 Tiny change: ' $deg(u)>=3$ and $de' -> ' $deg(u)>=\geq3$ and $de' (published)
en1 English Mhn_Neek 2024-06-29 16:46:33 722 Initial revision (saved to drafts)