#P8253. [NOI Online 2022 提高组] 如何正确地排序
[NOI Online 2022 提高组] 如何正确地排序
Background
After consideration by the administrators, we plan to store the community-provided testdata separately in the last Subtask. The score of these test points is 0, but failing any of them will be regarded as not passing this problem.
In this problem, there is an issue where the test point numbers in the judging records are mixed up. This is caused by a naming conflict in the community testdata. However, we guarantee that their relative order is not messed up.
Community testdata provider: @QwQcOrZ。
Problem Description
There is an array .
Define:
You need to compute 。
Input Format
The first line contains two positive integers 。
In the next lines, each line contains positive integers representing 。
Output Format
Output one positive integer in one line, representing the answer。
3 5
1 7 2 2 7
9 10 4 10 3
7 7 8 10 2
564
Hint
[Sample 1 Explanation]
Take as an example:
$$\begin{aligned}f(3,5)&=\max(a_{1,3}+a_{1,5},a_{2,3}+a_{2,5},a_{3,3}+a_{3,5})+\min(a_{1,3}+a_{1,5},a_{2,3}+a_{2,5},a_{3,3}+a_{3,5})\\&=\max(9,7,10)+\min(9,7,10)\\&=10+7\\&=17\end{aligned}$$The table of is given below. The entry in row and column represents :
$$\begin{array}{|c|c|c|c|c|}\hline20&27&18&22&20\\\hline27&34&24&29&23\\\hline18&24&20&22&17\\\hline22&29&22&24&22\\\hline20&23&17&22&18\\\hline\end{array}$$Their sum is the answer 。
[Samples 2, 3, 4]
See sort/sort*.in and sort/sort*.ans in the contestant directory。
[Constraints and Hints]
For all test points: ,,。
The specific limits for each test point are shown in the table below。
::cute-table{tuack}
| Test Point ID | ||
|---|---|---|
| ^ | ||
| ^ | ||
Translated by ChatGPT 5