比赛 |
20121106 |
评测结果 |
AAAAAAAAAAAA |
题目名称 |
H 指数因子 |
最终得分 |
100 |
用户昵称 |
Vow Ryan |
运行时间 |
0.012 s |
代码语言 |
Pascal |
内存使用 |
0.22 MiB |
提交时间 |
2012-11-06 11:47:42 |
显示代码纯文本
var
s,name:array[0..101]of string;
time,cnt,h:array[0..101]of longint;
i,j,k,l,m,n,p,t:longint;
c:char;
procedure swap(var a,b:string);
var
t:string;
begin
t:=a;a:=b;b:=t;
end;
procedure swap(var a,b:longint);
var
t:longint;
begin
t:=a;a:=b;b:=t;
end;
begin
assign(input,'publish.in');reset(input);
assign(output,'publish.out');rewrite(output);
readln(n);
for i:=1 to n do readln(s[i]);
for i:=1 to n do
begin
for j:=1 to n do
begin
read(c);
if c='1' then inc(time[j]);
end;
readln;
end;
name:=s;
for i:=1 to n do
for j:=1 to n-1 do
if name[j]>name[j+1] then swap(name[j],name[j+1]);
for i:=1 to n do
if name[i]<>name[i-1] then
begin
inc(m);
name[m]:=name[i];
end;
for p:=1 to m do
begin
fillchar(cnt,sizeof(cnt),0);
for i:=1 to n do
if s[i]=name[p] then
for j:=1 to time[i] do inc(cnt[j]);
for i:=1 to n do
if cnt[i]>=i then h[p]:=i;
end;
for i:=1 to m do
for j:=1 to m-1 do
if (h[j]<h[j+1])or((h[j]=h[j+1])and(name[j]>name[j+1])) then
begin
swap(h[j],h[j+1]);
swap(name[j],name[j+1]);
end;
for i:=1 to m do
writeln(name[i],' ',h[i]);
close(input);close(output);
end.