Luo Gu P1248 processing and production scheduling greedy

Positive Solutions: greedy

Report problem solving:

Portal $ QwQ $

$ Umm $ may be more difficult to see directly want, you can consider another question?

There are $ n $ mobs, mobs fight each $ a_i $ will be deducted from the blood, so after will rise $ b_i $ blood, and asked how much blood at least in order to make the whole blood is greater than zero?

$ Umm $ This is an entry-greedy problem lie? Would put all $ b_i-a_i> 0 $ is out, and then follow the $ a_i $ small to large order. Then for $ b_i-a_i <0 $, you can first reverse order look, it is deemed to come from the end of the turning point, it becomes the first buckle $ b_i $ blood and then picked up $ a_i $ blood, so by $ b_i $ small to large order (in reverse order from small to large, positive sequence is descending wailing $ QwQ $. then the answer is buckled during most of that node buckle blood Well $ QwQ $

Well then look at this question $ QwQ $

This question and discovered that in fact the model on a theme quite like.

Consider how to find the answers lie? The answer is found in $ \ sum b $ + a waste of time. So now is to minimize waste of time

What a waste of time is it? In fact, it is as similar to a child's questions, each task will cost $ a_i $ time, after the completion of $ b_i $ can reduce waste, then now is the least waste of time to ask how much? If we on a problem that can be said, at least how much a waste of time to pre-order the whole do not waste more time?

So on and on it to do the same title, $ over $

Guess you like

Origin www.cnblogs.com/lqsukida/p/11541209.html