#P7873. 「SWTR-7」Scores(easy version)
「SWTR-7」Scores(easy version)
Background
This problem is the easy version of Scores. Note that the constraints are different from the hard version.
Please pay attention to the special time and memory limits. A simplified statement is provided below the description.
Problem Description
There are students in Little A's class. They recently took an exam with subjects. The score of student in subject is an integer . For student , if there exists another student such that student 's score in every subject is not greater than student 's score, then student will feel upset.
The Mid-Autumn Festival is coming. Kind Little A does not want any classmate to feel upset, so he decides to hack the school's management system and modify everyone’s scores. Before doing such a risky thing, Little A wants to know whether he can achieve his goal. However, since there are too many students and subjects, he asks you to help construct a valid solution.
If there exists a score table where no student feels upset, output first, and then output any score table that satisfies the requirement; otherwise output .
"Simplified Statement"
Try to construct an matrix such that all elements are integers in , and for any there exists a such that .
Input Format
This problem has multiple test cases.
The first line contains an integer , indicating the test point ID.
The second line contains an integer , indicating the number of test cases.
For each test case:
One line contains two integers .
Output Format
For each test case:
If Little A's requirement cannot be achieved, output one line containing the string .
Otherwise, output one line containing the string , then output lines, each containing integers separated by spaces. The -th number on line represents .
0
4
5 3
1 10
17 1
2 7
YES
100 99 97
98 100 99
95 97 100
0 98 100
99 99 99
YES
1 2 3 4 5 6 7 8 9 10
NO
YES
95 99 76 88 87 51 49
72 100 80 92 100 60 60
Hint
"Special Judge"
This problem uses Special Judge. Please read the output format carefully. Wrong output format may lead to UKE.
The SPJ will first check whether your first line matches the correct answer.
If it matches and the answer is , the SPJ will then check whether your output satisfies Little A's requirement:
- and is an integer.
- Each student has at least one subject in which their score is higher than another student.
If a solution exists and you output but your construction is wrong, you will get of the score for that test point.
"Constraints and Notes"
This problem has 6 test points.
- Testcase #0 (1 point): the sample.
- Testcase #1 (10 points): .
- Testcase #2 (10 points): .
- Testcase #3 (20 points): .
- Testcase #4 (30 points): .
- Testcase #5 (29 points): no special constraints.
For of the testdata, , (except Testcase #0).
For all test points, time limit is 200 ms, memory limit is 16 MB.
"Source"
Sweet Round 07 A1.
idea & solution & data: Alex_Wei; validation: chenxia25.
Translated by ChatGPT 5