#P17205. 「DLESS-6」Tnemerced Tnemercni
「DLESS-6」Tnemerced Tnemercni
Problem Description
Player A and Player B are playing a two-player game. Before the game starts, there is an interval sequence of length : , and a given constant .
Player A moves first. She needs to write down a non-negative integer sequence such that .
Next, Player B performs several operations. Each operation is one of the following two types:
- Choose and , add to , with cost .
- Choose and , add to for all , with cost .
When Player B makes all elements in become , the game ends.
Player A wants to maximize the total cost of operations, while Player B wants to minimize the total cost of operations. You need to compute the final total cost when both players use optimal strategies.
Input Format
The first line contains two positive integers , representing the sequence length and the operation cost.
In the next lines, each line contains two non-negative integers .
Output Format
Output one line with one integer representing the answer.
5 2
4 5
1 6
2 3
1 5
3 6
16
5 3
1 8
4 5
2 3
7 9
8 10
30
15 4
84 102
23 31
1 13
70 82
54 85
39 66
11 83
42 93
52 90
49 89
22 25
103 123
13 43
26 103
103 119
800
Hint
Sample #1 Explanation
Player A can set the sequence to . In this case, it can be proven that the minimum total cost Player B can achieve is .
One possible sequence of operations with total cost is:
- Choose , and operate times, cost is . The sequence becomes .
- Choose , and operate times, cost is . The sequence becomes .
- Choose , and operate time, cost is . The sequence becomes .
- Choose , and operate times, cost is . The sequence becomes .
- Choose , , and operate times, cost is . The sequence becomes .
The total cost is .
Constraints
For all testdata, , , .
This problem uses bundled tests.
- Subtask 1 (10 pts): , .
- Subtask 2 (15 pts): .
- Subtask 3 (20 pts): .
- Subtask 4 (15 pts): .
- Subtask 5 (15 pts): .
- Subtask 6 (25 pts): no special constraints.
Translated by ChatGPT 5