比赛 |
20121106 |
评测结果 |
WWAWWWWWWWWW |
题目名称 |
H 指数因子 |
最终得分 |
8 |
用户昵称 |
warrior |
运行时间 |
0.004 s |
代码语言 |
Pascal |
内存使用 |
0.23 MiB |
提交时间 |
2012-11-06 10:00:45 |
显示代码纯文本
var nam:array[0..100]of string;h,fa,ru:array[0..100]of longint;
a:array[0..100,0..100]of longint; fl:boolean;c:char;
i,j,k,n,tn:longint;s:string;
procedure qs(l,r:longint);
var i,j,x,t:longint;
begin
i:=l;j:=r;x:=a[k,(l+r)div 2];
repeat
while a[k,i]>x do inc(i);while a[k,j]<x do dec(j);
if i<=j then begin t:=a[k,i];a[k,i]:=a[k,j];a[k,j]:=t;inc(i);dec(j);end;
until i>j;
if i<r then qs(i,r);if l<j then qs(l,j);
end;
procedure ss;
var i,j,t:longint;ts:string;
begin
for i:=1 to n-1 do for J:=i+1 to n do
if (h[i]<h[j])or((h[i]=h[j])and(nam[i]>nam[j])) then
begin t:=h[i];h[i]:=h[j];h[j]:=t;ts:=nam[i];nam[i]:=nam[j];nam[j]:=ts;end;
end;
begin
assign(input,'publish.in');assign(output,'publish.out');
reset(input);rewrite(output);
readln(tn);n:=0;for i:=1 to tn do fa[i]:=i;
for i:=1 to tn do
begin
readln(s);fl:=false;
for j:=1 to n do if nam[j]=s then begin fl:=true;fa[i]:=j;break;end;
if fl=false then begin inc(n);nam[n]:=s;end;
end;
for i:=1 to tn do
begin
for J:=1 to tn do begin
read(c);if c='1' then inc(ru[j]);
end;
readln;
end;
for k:=1 to n do
begin
for j:=k to tn do
if fa[j]=k then begin inc(a[k,0]);a[k,a[k,0]]:=j;end;
qs(1,a[k,0]);
for j:=1 to a[k,0]do if j=ru[a[k,j]] then h[k]:=j;
end;
ss;
for i:=1 to n do
begin writeln(nam[i],' ',h[i]);end; close(output);
end.