In the latest contest I solved2028C - Alice's Adventures in Cutting Cakein ~ O(nlog(n)). My first submission got TLE, which I found odd so I optimized it — tighter bound for BS and static array used for DP, wh
First to go over the solution quickly (skip down a few paragraphs if you already know the solution): one can use binary search to reduce the range of possible locations for the train to a constant multiple ofK, such as6K. Just make sure to expand out both ends of the range byKafter e...
CodeForces Algorithms. Contribute to m-aprameya/CodeForces development by creating an account on GitHub.