比赛 20121106 评测结果 WAAAAAWWWWWW
题目名称 H 指数因子 最终得分 41
用户昵称 张来风飘 运行时间 0.007 s
代码语言 Pascal 内存使用 0.17 MiB
提交时间 2012-11-06 08:44:39
显示代码纯文本
program project1;
var name,b,s:array[0..101] of ansistring;
    tot,h:array[0..101] of longint;
    n,t:longint;
procedure init;
var i,j:longint;
begin
     assign(input,'publish.in');reset(input);
     assign(output,'publish.out');rewrite(output);
     readln(n);
     for i:=1 to n do readln(name[i]);
     for i:=1 to n do readln(s[i]);
     fillchar(tot,sizeof(tot),0);
     for i:=1 to n do
         for j:=1 to n do
              if s[j][i]='1' then inc(tot[i]);
     t:=0;
end;
function find(x:longint):boolean;
var i:longint;
begin
     for i:=1 to t do
         if b[i]=name[x] then exit(true);
     exit(false);
end;
procedure main;
var i,j,k,temp,ttemp,y:longint;ss:ansistring;
begin
     for i:=1 to n do
         if not find(i) then
         begin
              inc(t);
              b[t]:=name[i];
         end;
     for i:=1 to t do
     begin
          temp:=0;
          for j:=1 to n do if name[j]=b[i] then inc(temp);
          for j:=1 to temp do
          begin
               ttemp:=0;
               for k:=1 to n do if name[k]=b[i] then
                   if tot[k]>=j then inc(ttemp);
               if ttemp>=j then h[i]:=ttemp else break;
          end;
     end;
     for i:=1 to t do
         for j:=i+1 to t do if (h[i]<h[j])or(h[i]=h[j])and(b[i]>b[j]) then
         begin
              ss:=b[i];b[i]:=b[j];b[j]:=ss;
              y:=h[i];h[i]:=h[j];h[j]:=y;
         end;
     for i:=1 to t do
         writeln(b[i],' ',h[i]);
     close(input);
     close(output);
end;
begin
     init;
     main;
end.