Commented solution code without using any data structure (UWCOI20D)

Previous C++ submission (Much slower as I forgot to use fast IO):

C++ submission link:
Python submission link:

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