#P83. [CSP-S 2022] Multiplication game
[CSP-S 2022] Multiplication game
Person in Charge
Problem Description
Little L and Little Q are playing a strategy game.
Given an array of length and an array of length , we define an matrix such that . All indices start from .
The game consists of rounds. For each round, four parameters are given in advance, satisfying and .
In each round, Little L first selects an index in the range , then Little Q selects an index in the range . The score of both players for this round is defined as .
Little L aims to maximize this score, while Little Q aims to minimize it. Both players are sufficiently smart and will always adopt the optimal strategy in each move.
Please find the score obtained in each round under their optimal strategies.
Input Format
The first line contains three positive integers , representing the length of array , the length of array , and the number of game rounds respectively.
The second line contains integers, denoting the elements of array .
The third line contains integers, denoting the elements of array .
The next lines each contain four positive integers, representing for the corresponding round of the game.
Output Format
Output lines, each with an integer representing the score of the corresponding round under the optimal strategies of Little L and Little Q.
Samples
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
Sample (1) Explanation
Matrix for this test case is as follows:
$$\begin{bmatrix} 0 & 0 \\ -3 & 4 \\ 6 & -8 \end{bmatrix}$$In the first round, no matter whether Little L chooses or , Little Q can always select a corresponding to make the final score negative. Thus, the optimal choice for Little L is to select , which guarantees a score of .
In the second round, Little L can choose , and Little Q has no choice but to select , resulting in a score of .
Sample (3)
See game/game3.in and game/game3.ans in the contestant's directory.
Sample (4)
See game/game4.in and game/game4.ans in the contestant's directory.
Data Range
For all test data, and . For each round of the game, and .
| Test Case No. | Special Condition | |
|---|---|---|
| 1, 2 | ||
| 1 | ||
| 2 | ||
| None | ||
| 1, 2 | ||
| 1 | ||
| 2 | ||
| None | ||
| 1, 2 | ||
| 1 | ||
| 2 | ||
| None |
Where:
- Special Property 1: It is guaranteed that .
- Special Property 2: For each round of the game, either or .