0%

START198B——Restricted Removals(字符串)

思路讲解

https://www.codechef.com/viewsolution/1179874822

我们的贪心做法用AI树状数组给过去了(其实我也想到了,但是我觉得复杂度也太离谱了吧,就没试)。

my solution is a kind of greedy.

It is not difficult to observe that delete the last element matched is the best, because it affect the least elements.

so just do it.

certainly, using vector or list can not go through all tests.

but if you using fenwick tree which can find the kth element, all problems will be solved.

AC代码

https://www.codechef.com/viewsolution/1179893708

心路历程(WA,TLE,MLE……)