Codeforces 1191C. Tokitsukaze and Discard Items 1190A. Tokitsukaze and Discard Items



Problem link

The order of discarding is given, so we can simulate the process of discarding.

In each time, we can calculate the page that contains the first special item that has not been discarded, and then locate all the special items that need to be discarded at one time. Repeat this process until all special items are discarded.

Each time at least one item would be discarded, so the time complexity is O(m).

A solution in c++


Post a Comment

0 Comments