#P14358. [CSP-J 2025] 座位
[CSP-J 2025] 座位
Problem Description
The second round of CSP-J 2025 is underway. There are contestants in the examination room where Little R is located, and the CSP-J 2025 first-round scores of all these contestants are pairwise distinct. All contestants are assigned seats in a snake-like order from highest score to lowest score according to their CSP-J 2025 first-round scores, and are arranged into rows and columns. Specifically, let the scores of all contestants in Little R's examination room be from highest to lowest. Then the contestant with score sits at column , row ; the contestant with score sits at column , row ; ; the contestant with score sits at column , row ; the contestant with score sits at column , row ; ; the contestant with score sits at column , row ; the contestant with score sits at column , row ; and so on.
For example, if , then all contestants are assigned seats in the order of the arrows in the figure below, according to their CSP-J 2025 first-round scores from highest to lowest.
:::align{center}
:::
Given the number of rows and the number of columns of the seats in Little R's examination room, as well as the CSP-J 2025 first-round scores of all contestants in that room, where is the CSP-J 2025 first-round score of Little R, you need to help Little R determine at which column and which row his seat is.
Input Format
The first line of input contains two positive integers , representing the number of rows and the number of columns of the seats in Little R's examination room, respectively.
The second line of input contains positive integers , representing the CSP-J 2025 first-round scores of all contestants in Little R's examination room, where is the CSP-J 2025 first-round score of Little R.
Output Format
Output two positive integers on a single line, representing that Little R's seat is at column , row .
2 2
99 100 97 98
1 2
2 2
98 99 100 97
2 2
3 3
94 95 96 97 98 99 100 93 92
3 1
Hint
Example 1 Explanation
In the order of scores from highest to lowest, the contestant with score sits at column , row ; the contestant with score sits at column , row ; the contestant with score sits at column , row ; and the contestant with score sits at column , row . Little R's score is , so his seat is at column , row .
Example 2 Explanation
In the order of scores from highest to lowest, the contestant with score sits at column , row ; the contestant with score sits at column , row ; the contestant with score sits at column , row ; and the contestant with score sits at column , row . Little R's score is , so his seat is at column , row .
Constraints
For all test data, it is guaranteed that:
- , ;
- for all , , and are pairwise distinct.
::cute-table{tuack}
| Test point | Special property | ||
|---|---|---|---|
| AB | |||
| ^ | None | ||
| ^ | |||
| A | |||
| ^ | ^ | B | |
| None | |||
| A | |||
| ^ | B | ||
| None | |||
| ^ | |||
| ^ | |||
Special property A: for all , .
Special property B: for all , .
Translated by QwenWork