比赛 20121106 评测结果 EEEEEEEEEEEE
题目名称 H 指数因子 最终得分 0
用户昵称 limitation 运行时间 0.001 s
代码语言 Pascal 内存使用 0.23 MiB
提交时间 2012-11-06 08:59:50
显示代码纯文本
program p1249;
 var n,i,j,l,ii,k,t,pp:longint;
     a:array[0..100,0..100]of longint;
     na:array[0..100]of string;
     v:array[0..100]of longint;
     h:array[0..100]of longint;
     s:string;
  begin
   assign(input,'publish.in');reset(input);
   assign(output,'publish.out');rewrite(input);
   readln(n);
   l:=0;
   for i:=1 to n do
    begin
     readln(s);
     k:=0;
     for ii:=1 to n do
      if na[ii]=s then k:=ii;
     if k<>0 then begin inc(a[k,0]);a[k,a[k,0]]:=i; end
      else begin inc(l);na[l]:=s;a[l,0]:=1;a[l,1]:=i; end;
    end;
   for i:=1 to n do
    begin
     readln(s);
     for j:=1 to n do
      if (s[j]='1')and(i<>j) then inc(v[j]);
    end;
   for i:=1 to l do
    for j:=a[i,0] downto 0 do
     begin
      pp:=0;
      for ii:=1 to a[i,0] do
       if v[a[i,ii]]>=j then inc(pp);
      if pp>=j then begin h[i]:=j;break; end;
     end;
   for i:=1 to l do
    for j:=i to l do
     begin
      if h[i]<h[j] then
       begin
        t:=h[i];
        h[i]:=h[j];
        h[j]:=t;
        s:=na[i];
        na[i]:=na[j];
        na[j]:=s;
       end;
      if (h[i]=h[j]) and(na[i]>na[j]) then
       begin
        t:=h[i];
        h[i]:=h[j];
        h[j]:=t;
        s:=na[i];
        na[i]:=na[j];
        na[j]:=s;
       end;
     end;
   for i:=1 to l do
    writeln(na[i],' ',h[i]);
   close(input);
   close(output);
  end.