luogu#P10561. [ICPC2024 Xi'an I] Smart Quality Inspector
[ICPC2024 Xi'an I] Smart Quality Inspector
题目描述
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:
输入格式
The first line contains three integers , described in the statement.
Then lines, the -th line of them contains two integers .
输出格式
An integer indicates the answer.
4 4 3
1 2
3 4
1 4
10