记录编号 |
48754 |
评测结果 |
AAAAAAAAAAAA |
题目名称 |
H 指数因子 |
最终得分 |
100 |
用户昵称 |
bw |
是否通过 |
通过 |
代码语言 |
Pascal |
运行时间 |
0.005 s |
提交时间 |
2012-11-06 15:20:09 |
内存使用 |
0.27 MiB |
显示代码纯文本
program ex;
var swap,n,x,l,sum,tt,i,j,k,tn,p,ll:longint;
lun:array[1..100,0..100] of longint;
yin,ans:array[1..100] of longint;
s,xx:string;
nam:array[0..100] of string;
hao:array[1..10000] of longint;
allname,dd:ansistring;
procedure jiao(x,y:longint);
var dy:longint;
dx:string;
begin
dy:=ans[x]; ans[x]:=ans[y]; ans[y]:=dy;
dx:=nam[x]; nam[x]:=nam[y]; nam[y]:=dx;
end;
procedure pai(x,y:longint);
var i,j,ji,max:longint;
begin
for i:=1 to tn-1 do
begin
max:=0;
for j:=i to tn do
begin
if ans[j]=max then
begin
if nam[j]<nam[ji] then ji:=j
end
else
if ans[j]>max then begin max:=ans[j]; ji:=j; end;
end;
jiao(ji,i);
end;
end;
begin
assign(input,'publish.in');
assign(output,'publish.out');
reset(input);
rewrite(output);
readln(n);
allname:=' ';
for i:=1 to n do
begin
readln(s); p:=pos(s,allname); ll:=length(s);
dd:=allname;
l:=length(dd);
sum:=0;
if p<>0 then
while (dd[p-1]<>' ')or (dd[p+ll]<>' ') do
begin
delete(dd,1,p);
inc(sum,p);
p:=pos(s,dd);
if p=0 then break;
end;
if p<>0 then
p:=p+sum;
if (p=0) then begin inc(tn);
nam[tn]:=s;
l:=length(allname); hao[l+1]:=tn;
allname:=allname+s;
allname:=allname+' ';
inc(lun[tn,0]);
lun[tn,lun[tn,0]]:=i;
end
else
begin
inc(lun[hao[p],0]);
lun[hao[p],lun[hao[p],0]]:=i;
end;
end;
for i:=1 to n do
begin
readln(xx);
for j:=1 to n do
begin
if xx[j]='1' then inc(yin[j]);
end;
end;
for i:=1 to tn do
begin
tt:=0;
for k:=1 to n do
begin
sum:=0;
for j:=1 to lun[i,0]do
if yin[lun[i,j]]>=k then inc(sum);
if sum>=k then tt:=k;
end;
ans[i]:=tt;
end;
pai(1,tn);
for i:=1 to tn do
begin
write(nam[i],' ');
writeln(ans[i]);
end;
close(input); close(output);
end.