luogu#P1915. [NOI2010] 成长快乐
[NOI2010] 成长快乐
Background
Description
Nemo is a carefree little fish with an initial weight of . Cute Nemo wants to grow as fast as possible, so it needs to eat as much food as it can. Nemo’s favorite food is shrimp in the sea.
Nemo knows the following about the food: there are shrimps in the sea, numbered from to , where the weight of shrimp is . Regard the ocean as an X-Y coordinate system. At time , shrimp is at position . Each shrimp moves in a straight line at a constant speed. The velocity vector of shrimp is , which means that at time , its position is .
Nemo is at position at time . It can move freely in the sea, but its speed does not exceed . Nemo hopes, through its own effort, to maximize the total weight of shrimps it eats within units of time (including time ).
If Nemo and a shrimp reach the same position at the same time, and the shrimp’s weight is less than Nemo’s current weight, then Nemo can eat that shrimp. After Nemo eats a shrimp of weight , its own weight increases by . Note that shrimps do not eat Nemo, and shrimps do not attack each other.
Nemo wants you to help make a growth plan so that the total weight of shrimps it eats is as large as possible.
Output Format
For the given input files nemo1.in nemo10.in, you need to submit the corresponding output files nemo1.out nemo10.out.
The first line of the output file contains an integer , indicating that in your growth plan, Nemo will eat shrimps.
The second line contains a real number , indicating the total weight of shrimps that Nemo eats in your plan.
The next lines each contain numbers . This means that at time , Nemo eats shrimp numbered at position . Here are real numbers, and is an integer.
To ensure the precision of the checker, it is recommended to output all real numbers with at least digits after the decimal point. In the checker, two real numbers are considered equal if their absolute difference does not exceed .
5 1 6 0 0
1
5 2 2 0 0
1
5
5 2 2 1
Hint
Sample explanation
In this sample, Nemo eats shrimp at position at time . In fact, Nemo could reach earlier, but the problem only requires that the speed not exceed .
Scoring
For each dataset, we set scoring thresholds . If your output is invalid, you get zero points. Otherwise, let the increase in Nemo’s weight in your plan be . Your score is determined by the following table:
| Score | Condition | Score | Condition |
|---|---|---|---|
| 10 | 5 | ||
| 9 | 4 | ||
| 8 | 3 | ||
| 7 | 2 | ||
| 6 | 1 |
How to use the checker
In the checker directory, run ./checker in out in the terminal.
Here, in is the input file provided by the problem, and out is your answer file for that input.
The checker only verifies the validity of your output. Final results are subject to the online judge.
Thanks to @FlierKing for providing the SPJ and to @虞皓翔 for helping improve the SPJ.
Translated by ChatGPT 5