比赛 |
20121106 |
评测结果 |
AAAAAAAAWWWW |
题目名称 |
H 指数因子 |
最终得分 |
66 |
用户昵称 |
bw |
运行时间 |
0.005 s |
代码语言 |
Pascal |
内存使用 |
0.27 MiB |
提交时间 |
2012-11-06 10:46:09 |
显示代码纯文本
program ex;
var swap,n,x,l,sum,tt,i,j,k,tn,p: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: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 qsort(x,y:longint);
var i,j,mid,l1,l2:longint;
begin
i:=x; j:=y;
mid:=ans[(i+j) div 2];
while i<j do
begin
while ans[i]>mid do inc(i);
while ans[j]<mid do dec(j);
if i<=j then
begin
if ans[i]=ans[j] then
begin
if nam[i]>nam[j] then jiao(i,j);
end
else jiao(i,j);
inc(i); dec(j);
end;
end;
if i<y then qsort(i,y);
if j>x then qsort(x,j);
end;
begin
assign(input,'publish.in');
assign(output,'publish.out');
reset(input);
rewrite(output);
readln(n);
for i:=1 to n do
begin
readln(s); p:=pos(s,allname);
if p=0 then begin inc(tn); nam[tn]:=s;
allname:=allname+' ';
l:=length(allname); hao[l+1]:=tn;
allname:=allname+s;
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;
qsort(1,tn);
for i:=1 to tn do
begin
write(nam[i],' ');
writeln(ans[i]);
end;
close(input); close(output);
end.