记录编号 48726 评测结果 AAAAAAAAAAAA
题目名称 H 指数因子 最终得分 100
用户昵称 Gravatarwarrior 是否通过 通过
代码语言 Pascal 运行时间 0.006 s
提交时间 2012-11-06 14:49:19 内存使用 0.23 MiB
显示代码纯文本
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;
var i,j,t:longint;
begin
 for i:=1 to a[k,0]-1 do for j:=i+1 to a[k,0] do
  if ru[a[k,i]]<ru[a[k,j]]then begin t:=a[k,i];a[k,i]:=a[k,j];a[k,j]:=t;end;
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;fa[i]:=n;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;
   for j:=1 to a[k,0]do
    if (ru[a[k,j]]>=j)and(ru[a[k,j+1]]<=j) then h[k]:=j;
  end;
 ss;
 for i:=1 to n do
  begin writeln(nam[i],' ',h[i]);end; close(output);
end.