Hi guys!
On IOI I've learned many new things, so now I want to give you a challenge. You probably remember my and Errichto's eliminations to VK Cup 2016. Let's focus on this problem: 674C - Levels and Regions
Main solution was solving it in O(n*k), because k wasn't greater than 50. What if k is just lower or equal to n? :D
solution