Welcome to the first week of competitive programming of the Fall of 2024! Today’s problem solving session will be a sort of warm up session, with problems designed to help you get used to the format of the event.
But first of all, if this is your first time ever in one of our competitive programming sessions, please follow the instruction on our new introduction guide to get started.
Here is the link to the problems.
This is an implementation problem, you don’t have to do anything too clever. Just follow the instructions on the problem statement.
Note that $N$ can be pretty large ($10^6$). So you’ll need a $\Theta(N)$ or $\Theta(N \log N)$ solution to solve this problem, and (if you are using Java) fast input.
A hint: sorting is your friend. If you don’t know how to sort in Java, use this method.
In this problem you might need to use a data structure to help you. You need something that lets you assign elements to groups, and then count the number of groups. (hint).