#10 [AH2017/HNOI2017] Boss

answer:

It looks complicated

If you analyze it, you will find that your self-confidence is useless

Just casually dp to see how many days you can have without using it to increase your confidence

Then the problem becomes

Find C1+C2+k=C

Then find that C has 10^8

Obviously enumerating C1 is not enough

Then considering C1 that satisfies the condition, C2 should not be too much

Consider getting them out first

This only needs hash+bfs

Let f[i][j] denote the current generation of the first i number, where the damage is j, and the minimum number of days to use

Then I found that the damage j was only about 6e5 in the end

First of all, if you enlarge the move 0 or 1 time, you will mess up. Consider the following twice.

A more violent method is

First enumerate k (1---100) and then enumerate C1

This is 6e5*100*20 a bit high, right?

Consider not enumerating k

We set the two damages as x1, x2 respectively

Then to satisfy x1+x2<=CC

In addition, d[x1]+d[x2]+(c-x1-x2)>=D

For the second formula written as (d[x1]-x1)+(d[x2]-x2)>=D-CC

Then just maintain the minimum value

I don't really understand why people call it a monotonic queue online. . . Its value range is only increasing but not decreasing. .

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325100258&siteId=291194637