比赛 |
20121106 |
评测结果 |
AAAAAAAAWWWW |
题目名称 |
H 指数因子 |
最终得分 |
66 |
用户昵称 |
DMC_DY |
运行时间 |
0.004 s |
代码语言 |
Pascal |
内存使用 |
0.20 MiB |
提交时间 |
2012-11-06 08:59:17 |
显示代码纯文本
type per=record
nam:string;
book,bt,h:longint;
end;
var a:Array[1..100]of per; p,pre,b:array[1..100]of longint; n,i,j,k,pt,dd:longint;
s,ss:ansistring; d:array[1..2000]of longint; //c:array[1..100,1..100]of longint;
function find(x,y:longint):boolean;
var i,j,k:longint;
begin
i:=a[x].bt; j:=0; k:=0;
while i<>0 do
begin
if b[p[i]]>y then inc(j) else if b[p[i]]=y then inc(k);
i:=pre[i];
end;
if(j<=y)and(j+k>=y)then exit(true); exit(false);
end;
procedure qsort(x,y:longint);
var i,j,m:longint; sc:string;
begin
i:=x; j:=y; m:=a[(x+y)>>1].h;
while i<j do
begin
while a[i].h>m do inc(i);
while a[j].h<m do dec(j);
if i<=j then
begin
if a[i].h<>a[j].h then
begin
a[i].h:=a[i].h xor a[j].h; a[j].h:=a[i].h xor a[j].h; a[i].h:=a[i].h xor a[j].h;
sc:=a[i].nam; a[i].nam:=a[j].nam; a[j].nam:=sc;
end else if(a[i].h=a[j].h)and(a[i].nam>a[j].nam)then begin sc:=a[i].nam; a[i].nam:=a[j].nam; a[j].nam:=sc;
end;
inc(i); dec(j);
end;
end;
if x<j then qsort(x,j); if y>i then qsort(i,y);
end;
procedure init;
begin
readln(n); s:=' '; pt:=0; dd:=0;
for i:=1 to n do
begin
readln(ss); j:=pos(ss,s);
if(j<>0)and(s[j-1]=' ')and(s[j+length(ss)]=' ')then
begin
inc(a[d[j]].book); inc(pt); p[pt]:=i; pre[pt]:=a[d[j]].bt; a[d[j]].bt:=i;
end
else begin
s:=s+ss+' '; inc(dd); d[pos(ss,s)]:=dd; inc(pt); j:=dd; inc(a[dd].book);
p[pt]:=i; pre[pt]:=a[dd].bt; a[dd].bt:=i; a[dd].nam:=ss;
end;
end;
end;
begin
assign(input,'publish.in'); assign(output,'publish.out'); reset(input); rewrite(output);
init;
for i:=1 to n do
begin
readln(ss);
for j:=1 to n do if ss[j]='1' then inc(b[j]);
end;
for i:=1 to dd do
begin
for j:=0 to a[i].book do if find(i,j) then
a[i].h:=j;
end;
qsort(1,dd);
for i:=1 to dd do writeln(a[i].nam,' ',a[i].h); close(input); close(output);
end.