记录编号 |
137889 |
评测结果 |
AAAAAAAAAA |
题目名称 |
[冲刺NOIP2014]高校排名 |
最终得分 |
100 |
用户昵称 |
铁策 |
是否通过 |
通过 |
代码语言 |
Pascal |
运行时间 |
0.041 s |
提交时间 |
2014-11-05 13:32:13 |
内存使用 |
0.32 MiB |
显示代码纯文本
program P1414;
var
a,b:array[0..100,0..100] of longint;
i,j,k,l,m,n:longint;
c,q:array[0..10000] of longint;
function find(x:longint):longint;
var
ls:longint;
begin
for ls:=1 to i-1 do if q[ls]=j then exit(ls);
exit(0);
end;
begin
assign(input,'unirank.in');
reset(input);
assign(output,'unirank.out');
rewrite(output);
fillchar(b,sizeof(b),$3f);
readln(n,m);
for i:=1 to m do
for j:=1 to n do
begin
read(k);
a[i,k]:=j;
end;
readln;
for i:=1 to n do
for j:=1 to n do
begin
l:=0;
for k:=1 to m do if a[k,i]<a[k,j] then inc(l);
if l=m then b[i,j]:=-1;
end;
for k:=1 to n do
for i:=1 to n do
for j:=1 to n do
if b[i,k]+b[k,j]<b[i,j]
then b[i,j]:=b[i,k]+b[k,j];
k:=0;
for i:=1 to n do
for j:=1 to n do
if b[i,j]<k then k:=b[i,j];
writeln(k*(-1)+1);
close(input);
close(output);
end.