#P10561. [ICPC 2024 Xi'an I] Smart Quality Inspector
[ICPC 2024 Xi'an I] Smart Quality Inspector
Description
Ella has a factory. One day, her factory is facing a product quality inspection.
Her factory has production lines. Among the production lines, of them are qualified, and the other lines are unqualified. The fine of the -th unqualified line is Yuan.
There are quality inspectors here. For the -th quality inspector, he will inspect from the -th line to the -th line and find the unqualified production line with the largest fine among them, then impose this fine on Ella.
Ella does not want to receive so many fines, so she decides to renumber the production lines to receive the least amount of fines. Please help her.
In simple terms:
You have a sequence of length , . Here are given.
There are pairs of integers, each pair consists of two numbers .
You need to rearrange sequence to minimize the following:
Input Format
The first line contains three integers , described in the statement.
Then lines, the -th line of them contains two integers .
Output Format
An integer indicates the answer.
4 4 3
1 2
3 4
1 4
10
京公网安备 11011102002149号