#P8818. [CSP-S 2022] 策略游戏
[CSP-S 2022] 策略游戏
Description
Xiao L and Xiao Q are playing a strategy game.
Given an array of length and an array of length , define an matrix such that . All indices start from .
The game has rounds. In each round, parameters are given in advance, satisfying and .
In the game, Xiao L first chooses an index between , and then Xiao Q chooses an index between . The score of this round is defined as .
Xiao L’s goal is to make this score as large as possible, while Xiao Q’s goal is to make it as small as possible. Both players are sufficiently smart and always use optimal strategies.
Question: Under both players’ optimal strategies, what is the score in each round?
Input Format
The first line contains three positive integers , , , representing the lengths of array , array , and the number of game rounds.
The second line contains integers , the elements of array .
The third line contains integers , the elements of array .
Then follow lines. Each line contains four positive integers, representing for this round.
Output Format
Output lines. Each line contains one integer, representing the score in that round under the players’ optimal strategies.
3 2 2
0 1 -2
-3 4
1 3 1 2
2 3 2 2
0
4
6 4 5
3 -1 -2 1 2 0
1 2 -1 -3
1 6 1 4
1 5 1 4
1 4 1 2
2 6 3 4
2 5 2 3
0
-2
3
2
-1
Hint
Sample Explanation #1
In this dataset, the matrix is as follows:
$$\begin{bmatrix} 0 & 0 \\ -3 & 4 \\ 6 & -8 \end{bmatrix}$$In the first round, no matter whether Xiao L chooses or , Xiao Q can choose some to make the final score negative. Therefore, choosing is optimal for Xiao L, because then the score is guaranteed to be .
In the second round, since Xiao L can choose , Xiao Q can only choose , so the score is .
Sample #3
See the attachments game/game3.in and game/game3.ans.
Sample #4
See the attachments game/game4.in and game/game4.ans.
Constraints
For all testdata, , . For each round, , .
| Test point ID | Special condition | |
|---|---|---|
| 1, 2 | ||
| 1 | ||
| 2 | ||
| None | ||
| 1, 2 | ||
| 1 | ||
| 2 | ||
| None | ||
| 1, 2 | ||
| 1 | ||
| 2 | ||
| None |
Here, special property 1: guarantee .
Special property 2: guarantee that for each round, either or .
Translated by ChatGPT 5
京公网安备 11011102002149号