It happened to me twice to skip a CF round because of the registration. Once I was too late, and once I even implemented A and tried to submit — but it turned out I haven't registered. It also happened to some of my friends.
For standard CF rounds the registration ends 5 minutes before the contest. The reason is that participants must be divided into rooms, to be able to hack. But hacking isn't so important, right? It's some extra possibility and many would enjoy a round even without hacks.
Let's allow participating without having a room. All people registered at least 5 minutes before should be assigned to rooms as usually. And after that, one should be able to register "out of room" — to participate without hacking and being hacked. A round should be rated for everybody. So, one could register after reading problems, and maybe even after implementing something.
Note that hacks are only a privilege. It's good to be hacked instead of getting WA on systests, and it's good to be able to hack others. So, it will be optimal to register before a round, if possible.
Does anybody see any drawbacks? If not, then make this change please. @CF_TEAM









values to consider because we don't care about numbers much larger than
. The answer will be equal to the sum of values of
. Creating an additional array with prefix sums will allow us to calculate such a sum in
.
. The explanation isn't complicated. We can't be faster than
because we fight at most two criminals in each hour. And maybe e.g.
where every sum denotes the sum over
possible divisions.
and then we will get
(this is what we're looking for).
.
then we should increase
ways to divide numbers into two groups. For fixed division of numbers and for fixed position of the smallest number in
for all
so it's enough to add
to the result. There is
. Don't be misled by words "simple to calculate". It took me literally weeks to solve this problem and I don't say that it is easy to find the formula above.
. You can find my code above.
and 



times multiplying matrices
.
solution. We divide a sequence into
Parts. When choosing the best candidate in a Part, we want to forget about other Parts. It's enough to remember only
and then construct new hull for this Part in
from complexity. First, binary search can be replaced with pointers — for each Part initially we set a pointer at the beginning of Part. To find best candidate in Part, we slowly move pointer to the right (by one). Complexity is amortized
. And we can sort linear functions
. Note that when rebuilding a hull, we must set pointer to the beginning of Part.
. 

