记录编号 |
48705 |
评测结果 |
AAAAAAAAAAAW |
题目名称 |
H 指数因子 |
最终得分 |
91 |
用户昵称 |
DMC_DY |
是否通过 |
未通过 |
代码语言 |
Pascal |
运行时间 |
0.003 s |
提交时间 |
2012-11-06 14:17:35 |
内存使用 |
0.20 MiB |
显示代码纯文本
type per=record
nam:string;
book,bt,h:longint;
end;
var a:Array[0..100]of per; p,pre,b:array[1..100]of longint; n,i,j,k,pt,dd,l:longint; v:array[1..100]of boolean;
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;
k:=0; a[0].h:=-31354; a[0].nam:='zzzzzzz';
for i:=1 to dd do begin k:=0;
for j:=1 to dd do if not(v[j]) then
if a[j].h>a[k].h then k:=j else if(a[j].h=a[k].h)and(a[j].nam<a[k].nam)then k:=j;
writeln(a[k].nam,' ',a[k].h); v[k]:=true;
end;
close(input); close(output);
end.