Commented solution code without using any data structure (UWCOI20D)

Previous C++ submission (Much slower as I forgot to use fast IO):
https://www.codechef.com/viewsolution/29909032

C++ submission link: https://www.codechef.com/viewsolution/29910556
Python submission link: https://www.codechef.com/viewsolution/29910568

The above codes don’t use segment trees or any other data-structures (An O(N^2) solution).

If you have any questions, please feel free to ask in the comments :smiley:

Official editorial: UWCOI20D - Base Plans - Editorial

7 Likes