比赛 20121106 评测结果 AAAAAAAAAAAA
题目名称 H 指数因子 最终得分 100
用户昵称 CAX_CPG 运行时间 0.005 s
代码语言 Pascal 内存使用 0.36 MiB
提交时间 2012-11-06 11:35:12
显示代码纯文本
uses math;

type oo=record
      s:string;
      n:longint;
     end;

var a:array[0..100]of oo;
    b:array[1..100,0..100]of longint;
    v,sum,c,f:array[0..100]of longint;
    mx,n,i,j,tot:longint;
    s:string;
    p:boolean;
    ch:char;

function da(x,y:oo):boolean;
begin
 if x.n>y.n then exit(true);
 if x.n<y.n then exit(false);
 if x.s<y.s then exit(true);
 exit(false);
end;

begin
 assign(input,'publish.in');reset(input);
 assign(output,'publish.out');rewrite(output);
 readln(n);tot:=0;
 for i:=1 to n do
  begin
   readln(s);p:=false;
   for j:=1 to tot do if a[j].s=s then
    begin p:=true;inc(b[j,0]);b[j,b[j,0]]:=i;end;
   if not(p)then
    begin inc(tot);a[tot].s:=s;inc(b[tot,0]);b[tot,1]:=i;end;
  end;
 for i:=1 to n do
  begin
   for j:=1 to n do begin read(ch);if ch='1' then inc(c[j]);end;
   readln;
  end;
 for i:=1 to tot do
  begin
   for j:=1 to b[i,0]do begin f[j]:=c[b[i,j]];mx:=max(mx,f[j]);end;
   fillchar(v,sizeof(v),0);fillchar(sum,sizeof(sum),0);
   for j:=1 to b[i,0]do inc(v[f[j]]);
   for j:=mx downto 0 do sum[j]:=sum[j+1]+v[j];
   for j:=mx downto 0 do if (sum[j]>=j)and(sum[j]-v[j]<=j) then break;
   a[i].n:=j;
  end;
 for i:=1 to tot-1 do
  for j:=i+1 to tot do
   if da(a[j],a[i])then
    begin a[0]:=a[i];a[i]:=a[j];a[j]:=a[0];end;
 for i:=1 to tot do
  writeln(a[i].s,' ',a[i].n);
 close(output)
end.