Hello Everyone,

The problem set of the 2017 Hackatari Codeathon will be available in Codeforces Gym tomorrow, Monday Feb/13/2017 19:00.

You will have 9 problems and 5 hours to solve them. However, the problems' difficulty is similar to Div.2 contests, so you might only need half of that time to solve them.

The problem set was prepared by Hasan0540, linkinu, and Maram Tuffaha.

Thanks to AmrMahmoud and Deadwing for testing the problem set.

Good luck!

Well I'll probably need more than half the time to solve some of them but thanks anyways for the contest. Will there be an editorial released afterwards?

Could someone give me some hints about problem B — 2Trees please?

HintCheck on some random trees what are the depths of leaves merging in optimal answer.

SolutionLets precalc two arrays for each of trees:

leavesOddandleavesEven(leaves of odd and even depths from the root of tree, it doesnt matter what to choose as a root).Then you can notice that answer is always either 2 or 3.

2 can be achieved only when (

leavesOdd_{0}=leavesOdd_{1}andleavesEven_{0}=leavesEven_{1}) or (leavesOdd_{0}=leavesEven_{1}andleavesEven_{0}==leavesOdd_{1}). It's because all the paths will be of the same parity and thus can be colored in 2 colors (color the first root into 1 and then layer by layer alterate color).The other cases it's 3 because in any path which is of nonoptimal parity you can color leaf in the third color and connect it to path of whatever parity tou need.

Bro , we need editorial for this sweet contest :)

There will be an editorial available ?