SHORT - Editorial

PROBLEM LINKS

Practice
Contest

DIFFICULTY

HARD

EXPLANATION

You can view the editorial here.
Anton Lunyov provided an alternative explanation to this problem. You can view his version here.

SETTER’S SOLUTION

Can be found here.

//