记录编号 48731 评测结果 AAAAAAAAAAAA
题目名称 H 指数因子 最终得分 100
用户昵称 Gravatardigital-T 是否通过 通过
代码语言 Pascal 运行时间 0.004 s
提交时间 2012-11-06 14:54:42 内存使用 0.25 MiB
显示代码纯文本
var
w:boolean;ww:string;
au,st,write1:array[1..100]of string;
g,num,outh,write2:array[1..100]of integer;
hh:array[1..100,1..100]of integer;
n,i,j,k,h,h1,h2,h3,max:integer;
begin
assign(input,'publish.in');reset(input);
assign(output,'publish.out');rewrite(output);
fillchar(g,sizeof(g),false);fillchar(outh,sizeof(outh),0);
readln(n);
k:=0;
for i:=1 to n do begin g[i]:=i;num[i]:=1;end;
for i:=1 to n do
 begin
  readln(au[i]);
  for j:=1 to i-1 do if au[i]=au[j] then begin g[i]:=j;inc(num[j]);break;end;
 end;
for i:=1 to n-1 do readln(st[i]);
read(st[n]);
//________________________________
for i:=1 to n do//author
 if g[i]=i then
   for j:=1 to n do//essay
    if g[j]=i then
     for k:=1 to n do
      if (k<>i)and(st[k][j]='1')then inc(hh[i,j]);
//________________________________
for k:=1 to n do//author
 if g[k]=k then
  for h:=num[k] downto 0 do//h
   begin
    h1:=0;//higher
    h2:=0;//below
    h3:=0;//same
    for i:=1 to n do//essay
     if g[i]=k then
      begin
            if hh[g[i],i]>h then inc(h1);
            if hh[g[i],i]<h then inc(h2);
            if (hh[g[i],i]=h)and(h>0) then inc(h3);
      end;
    //writeln(k,' ',h,' ',h1,' ',h3);
    if(h<=h1+h3)and(outh[k]=0)then outh[k]:=h;
    //writeln('outh[',k,']',':=',outh[k]);
   end;

{for i:=1 to n do
 begin
  for j:=1 to n do
  write('i=',i,'j=',j,' ',hh[i,j],' ');
  writeln;
 end;   }
//________________________________
max:=0;
for k:=1 to n do
 if g[k]=k then
  begin inc(max);
        write1[max]:=au[k];
        write2[max]:=outh[k];end;
for i:=1 to max-1 do
 for j:=i+1 to max do
  if write2[i]<write2[j]then
   begin
    ww:=write1[i];
    write1[i]:=write1[j];
    write1[j]:=ww;
    k:=write2[i];
    write2[i]:=write2[j];
    write2[j]:=k;
   end;
for i:=1 to max-1 do
 begin
  j:=i;
  while (write2[j+1]=write2[i])and(j<max)do inc(j);
  for h1:=i to j-1 do
   for h2:=h1+1 to j do
    if write1[h1]>write1[h2]then
    begin
     ww:=write1[h1];
     write1[h1]:=write1[h2];
     write1[h2]:=ww;
     k:=write2[h1];
     write2[h1]:=write2[h2];
     write2[h2]:=k;
    end;
 end;



for i:=1 to max-1 do writeln(write1[i],' ',write2[i]);
write(write1[max],' ',write2[max]);
close(input);close(output);
end.