当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

4880:ZCC loves ranklist

Special Judge 特殊评判
题目描述
Forced by students' parents, ZCC's teacher GPS has to open the scoreboard of the students. But this will bring many problems. So GPS intends only to open the first k ranklists of the tests. In order to avoid the arrogancy and the abandonment, GPS wants to make the difference between the highest ranking sum and the lowest ranking sum as small as possible.
At the same time, in order to reflect that each student is different, GPS defines the Progress Index.Progress Index exists between two exams. For two adjacent examinations, define NewRank as the ranking of the latter test, OldRank as the ranking of the formal one, and n as the number of students in the class.

ProgressIndex=
   0,if NewRank=OldRank
   OldRank-NewRank-max(OldRank,NewRank)/n,if NewRank>OldRank
   OldRank-NewRank+max(OldRank,NewRank)/n,if NewRank<OldRank

If there are two Pogress Indexs in different tests have the same absolute value or there are two Pogress Indexs in the same test have the same value, GPS will be unhappy, he thinks it violated the differences between students. GPS wants to know if this situation can keep to the end of exactly n exams. Because this problem is too hard so GPS only ask you to give the answers when n<=100.
(Note: No two students can have the same rank in a test, the ranks will be 1..n)
输入解释
There are multiple test cases end with EOF(no more than 10 test cases).
Each test case contain a line of two integers n,k indicating the number of students and the number of tests in the first question.(2<=n<=10000,1<=k<=n,n*k<=10000)
输出解释
For each test case:
The first question: The first line contain an integer indicating the smallest difference between the highest ranking sum and the lowest ranking sum. Next n lines each line contain k integers, the i+1-th line indicating the ranks of the student i.
The second question: The first line contain "Yes" or "No"(without quotes) indicating if the situation can keep to the end of exactly n exams. If the answer is "Yes" and n<=100 then next n lines each line contain n integers, the i+1-th line indicating the ranks of the student i.
If there are multiple solutions, output any.
输入样例
3 3
4 2
输出样例
Case #1:
0
1 2 3
2 3 1
3 1 2
No
Case #2:
0
1 4
2 3
3 2
4 1
Yes
1 2 4 1
2 1 3 2
3 4 2 3
4 3 1 4

提示
The solution of the sample output is not the only solution.
来自杭电HDUOJ的附加信息
Author 镇海中学
Recommend

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-4880

最后修改于 2020-10-25T23:17:44+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)