#P10582. [蓝桥杯 2024 国 A] 最强策略家
[蓝桥杯 2024 国 A] 最强策略家
Problem Description
In an intellectual board game, two players, Xiao Lan and Xiao Qiao, need to operate on an matrix whose initial values are all , in order to show their wisdom and strategy and determine who is the strongest strategist.
The rules are as follows:
- Xiao Lan moves first. After he finishes his move, it is Xiao Qiao’s turn, then Xiao Lan’s turn again, and so on alternately.
- On each of Xiao Lan’s turns, he can choose elements in the matrix and change the values of these elements to .
- On Xiao Qiao’s -st turn, he can choose a submatrix and reset all elements in that submatrix to . On Xiao Qiao’s -nd turn, he can choose a submatrix and reset all elements in that submatrix to . By analogy, on Xiao Qiao’s -th turn, he can choose an submatrix and reset all elements in that submatrix to .
- After both sides have each made moves, the game ends.
Let be the maximum number of elements with value that ever appears during the entire game.
Xiao Lan tries to maximize , while Xiao Qiao tries to minimize .
Assuming both players have perfect logical reasoning ability and always take the best strategy, what will be (that is, what is the maximum number of elements with value during the whole game)?
Input Format
The first line contains an integer , representing the number of test cases.
The next lines each contain an integer , representing the size of the matrix.
Output Format
For each test case, output one line containing an integer, representing the answer.
2
2
5
3
5
Hint
[Sample Explanation]
In the first sample, Xiao Lan and Xiao Qiao take turns operating on a matrix.
Initial matrix state:
Xiao Lan’s 1st turn: Change two elements with value to . A possible state is:
Xiao Qiao’s 1st turn: Xiao Qiao can only choose a submatrix to reset the element to . In order to minimize the number of elements with value , Xiao Qiao needs to reset one element that is already to . A possible state is:
Xiao Lan’s 2nd turn: Xiao Lan again changes two elements with value to . A possible state is:
Xiao Qiao’s 2nd turn: Xiao Qiao can choose a submatrix (that is, the whole matrix) and reset all values to .
Therefore, when both sides use the best strategy, the maximum number of elements with value in the matrix can reach .
[Constraints and Notes for Testcases]
For of the test cases, , .
For all test cases, , .
Translated by ChatGPT 5