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

建议使用的浏览器:

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

2584:Unversity Rankings

题目描述
At present, the university rankings are very popublar.They help senior high school students to choose universities for study.For example,you can find the CHINESE UNIVERSITY RANGKINGS at http://www.netbig.com/.
As we know ,a university ususally has many different departments,such as department of Language(FLS).some of them are quit good when comparing to other universities,but others are not.So,most of universities'rangkings are are composed of several ranking lists, each list for one department.
But here comes a problem that sometimes it's hard to determine which universities is better,when comparing two universities with each othe.Fortunately,Doctor Bob has advanced a new concept named "absolutely better",with which the problem above can be solved.
Now,here is a an example to explain the concept "absolutely better":
Assum that there are three universities (X,Y,Z)and every university has three department:CS,EE and FLS.And the rangkings of the departments are as the followed:
The rankings of the CS:X>Y>Z(X>Y means X has a better CS department than Y)
The rankings of the EE:X>Z>Y
The rankings of the FLS:Z>X>y
Obviously,each each department of University X is better than that of University Y. Then,it's called that X is absolutely better than Y.Using the "absolutely better"concept, it becomes better to compare some paires of Universities.
Now Bob has the complete rangkings of different departments of many universities,and he wants to find k universities(U1,u2,....Uk)such that Ui is absolutely better that Uj(for any i<j).
输入解释
The first line of the input is a positive integer C.C is the number of test cases
followed.
The first line of each test case is two positive integers N,M(0<N,M<=100),N is the number of the universities and M is the number of departments.And then M lines follow.The i(th)(1<=i<=M)line contains N numbers Ui(1<=i<=N,1<=Ui<=N),indicating the ranking of the i(th)department.If Universitites Ui preceds to University Uj in line k(th department, then the k(th)department do Ui is better than k(th) department of Uj.
输出解释
The output should consist fo C lines, one lines for each test case.Each line only constains one integer- the maximum values fo k as descriped above.No redundant spaces are needed.
输入样例
1
3 3
1 2 3
1 3 2 
3 1 2
输出样例
2
来自杭电HDUOJ的附加信息
Recommend lcy

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

源链接: HDU-2584

最后修改于 2020-10-25T22:54:55+00:00 由爬虫自动更新

共提交 0

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