EVEDG - Editorial

Just sharing my solution. It might be helpful for folks who code in JAVA.
Solution:- CodeChef: Practical coding for everyone
Hope this helps!

I’m getting TLE only for task#6 of subtask 1 . It would to helpful if the test cases are revealed after the contest.

According to editorial , if graph has odd no of edges we can remove one vertex with odd degree and put that in another group and just with k = 2 we have both groups having even edges but for image shared above if we put one of the vertex of cut set we will get 3 groups having 1,1,0 edges but our logic will give 2 groups as output so I think editorial is either wrong or it missed some boundary condition .
can you help me , how can i implement cut edge boundary condition .

Read again. The problem nowhere said that the graph has to be connected.

You get 1 group with 0 edges, and 1 group with 2 connected components having 3 and 1 edges respectively. Both of these are part of a single group.

3 Likes

yaa ,got it .Thanks for explaining.

1 Like

Same
(10 chars)

Thanks For explaining . I read Editorial again and it helped me . Finally got accepted :grinning:

1 Like

Sample test-case output doesn’t match testers. Please correct it.

Output of sample case as explained :-

2
1 2 1 1 2

Correct Solution/Testers solutions gives :-

2
1 2 1 1 1

I don’t think so, in the third case, removing two nodes with even number of edges don’t mean removeing odd numbers of edges, if there two edge between the two nodes, it is also remove even edges