#P3885. [JLOI2009] F1一级方程式大赛

[JLOI2009] F1一级方程式大赛

Description

{{We know that in F1, if all other parameters are the same, a car’s speed mainly depends on its fuel load. Carrying too much fuel will slow the car down and increase fuel consumption per lap; carrying too little fuel requires more pit stops to refuel. Therefore, a key task for the think tank is to determine the initial fuel load and the pit-refueling plan before each race so that the total time to complete all laps is as short as possible.

As the chief programmer Dr. Liu, the team’s task is to write a program to determine Schumacher’s initial fuel load before the race and the pit-refueling plan during the race.}}

Input Format

{{The input consists of the following 77 numbers:

  • The total number of laps nn (a positive integer).
  • The time for a theoretically empty car with no fuel to complete one lap (floating-point, in seconds).
  • For each additional 11 liter of fuel, the extra time per lap (floating-point, in seconds).
  • The fuel consumed per lap for a theoretically empty car with no fuel (floating-point, in liters).
  • For each additional 11 liter of fuel, the additional fuel consumption per lap (floating-point, in liters, and this number is strictly less than 11).
  • The time spent for each pit stop (floating-point, in seconds; this does not include the time spent refueling, which is determined by the next input parameter).
  • After each pit stop, the time spent per additional 11 liter of fuel added (floating-point, in seconds).

We always treat one whole lap as a unit. Changes in fuel during a lap are not considered. Refueling is allowed only after completing a whole lap.}}

Output Format

{{- The first line contains three numbers:

  1. The minimum total time needed for Schumacher’s car to finish all laps (floating-point, rounded to three decimals).
  2. The initial fuel load before the race (floating-point, rounded to three decimals).
  3. The number of pit stops for refueling during the race mm (integer).
  • Then follow mm lines, each containing two numbers:
    1. The number of laps completed at the time of the ii-th pit stop for refueling (integer).
    2. The amount of fuel added at the ii-th pit stop (floating-point, rounded to three decimals).}}
3  100  0  10  0  20  0
300.000  30.000  0
3  100  2  10  0.1  20  1
422.469  23.457  1
2  11.111

3  100  4  10  0  20  1
480.000  10.000  2
1  10.000
2  10.000

Hint

{{For all testdata, 1n1001 \le n \le 100, and all other input numbers lie in the range [0,100][0, 100].}}

Translated by ChatGPT 5