#P9762. [ROIR 2021] 分割数表 (Day 1)
[ROIR 2021] 分割数表 (Day 1)
Background
Translated from ROIR 2021 Day1 T2 Разбиение таблицы。
Problem Description
There is an number table , where .
Now split this table into two tables so that is minimized.
More concretely, you may choose an , then make one vertical cut between column and column , or make one horizontal cut between row and row . The two resulting tables are and .
Please construct one valid plan.
Input Format
This problem has multiple test cases.
The first line contains an integer .
The next lines each contain two integers , representing the size of the table in this query.
Output Format
For each query, output a character and an integer .
If you want to cut vertically, let be V, and let be your chosen .
If you want to cut horizontally, let be H, and let be your chosen .
If there are multiple solutions, output a vertical cut. If there are still multiple solutions, output the one with the smallest .
5
1 3
4 7
1 10
3 3
3 5
V 3
V 5
V 8
H 3
V 4
Hint
Constraints:
For all subtasks, , , .
| Subtask ID | Constraints | Score |
|---|---|---|
| , | ||
| , | ||
| , | ||
| , | ||
| No special constraints |
Translated by ChatGPT 5