Please, try EDU on Codeforces! New educational section with videos, subtitles, texts, and problems. ×

### vinupreethi93's blog

By vinupreethi93, history, 5 weeks ago, ,

i cant understand the problem. https://codeforces.com/problemset/problem/1325/C

can someone help me please

• -19

 » 5 weeks ago, # |   0 You have to mark the edges with some numbers from 0 - (N-2) in such a way that, if you go from any vertex (u) to any other vertex (v) the element that doesn't exist in a simple path from u to v is minimum.
•  » » 5 weeks ago, # ^ | ← Rev. 2 →   0 Consider TestCase-2, If you have to go from vertex 1 to 6 you have to go like this:1 - 2 -> edge value — 0 2 - 5 -> edge value — 45 - 6 -> edge value — 1So, the minimum value that doesn't exist in this path is value 2
•  » » » 5 weeks ago, # ^ | ← Rev. 2 →   0 Suppose say the path from u=1, v=6 the numbers in edges are 0, 4, 1 now the next minimum number on the edge should be 2, so i can fill it in 1-3 as well as 2-4 right??
•  » » » » 5 weeks ago, # ^ | ← Rev. 2 →   0 No. You didn't understand what MEX is.
•  » » » » » 5 weeks ago, # ^ | ← Rev. 2 →   0 Yeah i can understand it now thank you
•  » » » » » 2 weeks ago, # ^ |   0 Hi sorry im unable to reply to you.dont know why
•  » » » » » » 2 weeks ago, # ^ |   0 That's okay.
 » 5 weeks ago, # |   0 You have a tree with n vertices, so n-1 edges. Mark all the edges with numbers from 0 to n-2. Take any pair of vertices and write down the numbers on the edges in the shortest path between them. Find the MEX of this array. If you understand how MEX works, the problem is simple. The MEX of any path that doesn't contain the edge labeled 0 is 0. Find a vertex which has more than 3 edges, and mark them 0, 1, 2. Mark the remaining edges randomly. This ensures that the maximum MEX is 2.
•  » » 5 weeks ago, # ^ | ← Rev. 2 →   0 Thank you, i can understand!