Good evening.
I’d like you to invite for CodeChef April Cook-Off that will start at 21:30 IST of 23rd April 2017 (check your time zone here) and will last 2.5 hours.
Problems are prepared by me and kingofnumbers. Testers are mnbvmar and PraveenDhinwa (who is also an editorialist). Translators: huzecong, Team VNOI, CherryTree (Mandarin, Vietnamese and Russian respectively).
There is no registration required, anybody with a CodeChef handle can participate.
We want cook-off contests to attract even the strongest competitors. You will be provided 5 problems, with difficulty div2-A through div1-E. We expect even the best to struggle to solve all the problems.
I wish you great fun and no frustrating bugs. See you on the leaderboard!
Additional announcement: we look for setters, testers and editorialists, especially for a setter for the coming lunchtime contest. You can reach me by PM on Codeforces.







. What should be stored in such a tree?

code in C++, with binary search:
from the starting cell. That sum can't exceed
what is enough to get AC. It isn't hard to get rid of the logarithm factor what you can see in the last code below.





. The limit from the statement is 


or better.

where

.
.
where
let's keep the distance to the next power of 42. After each "add on the interval" we should find the minimum and check if it's positive. If not then we should change value of the closest power of 
. Changing one coefficient affects up to
consecutive bits there and we want to get a sequence with only
(and at the end we want at least
). At the same time, we should keep people in
and it doesn't depend on a constant
or faster. Can you solve the problem in linear time?
. Then, check if the max flow in this graph is at least
where
is from using set of forbidden edges.
but you could get AC with very fast solution with extra 

