the difference easy hard version constraintspolycarp write coursework the coursework consist m pagesPolycarp n cup coffee the coffee ith cup a_i caffeine Polycarp drink cup coffee he drink cup order Polycarp drink cup instantly completely ie split cup dayssurely coursework usually write single day perfect world Berland some require multiple day hard worklet consider day Polycarps work consider Polycarp drink k cups coffee day caffeine dosage cup Polycarp drink day a_i_1 a_i_2 dot a_i_k then cup drink give energy write a_i_1 page coursework second cup give energy write max0 a_i_2 1 page cup give energy write max0 a_i_3 2 page kth cup give energy write max0 a_i_k k 1 pagesif Polycarp do not drink coffee day write coursework daypolycarp finish coursework soon possible spend minimum number day your task find number day impossible