比赛 |
20130725暑期B班1测 |
评测结果 |
AAAAAT |
题目名称 |
黑叔 |
最终得分 |
83 |
用户昵称 |
bingo |
运行时间 |
1.041 s |
代码语言 |
Pascal |
内存使用 |
5.12 MiB |
提交时间 |
2012-07-18 11:28:13 |
显示代码纯文本
var
i,j,k,l,n,st,et:longint;
time:longint;
s:string;
t,d:array[1..10000]of longint;
c,e:array[1..10000]of string;
f,g:text;
begin
assign(f,'hey.in');
assign(g,'hey.out');
reset(f);
rewrite(g);
readln(f,n);
for i:=1 to n do
begin
readln(f,c[i]);
for j:=1 to length(c[i]) do
if c[i][j]=' 'then break;
val(copy(c[i],1,j-1),l,k);
t[i]:=l;
st:=j+1;
for j:=length(c[i]) downto 1 do
if c[i][j]=' 'then break;
et:=j-1;
val(copy(c[i],j+1,length(c[i])-j),l,k);
d[i]:=l;
e[i]:=copy(c[i],st,et-st+1);
end;
c:=e;
for i:=1 to n-1 do
for j:=i+1 to n do
begin
if t[i]>t[j] then begin
k:=t[i];t[i]:=t[j];t[j]:=k;
k:=d[i];d[i]:=d[j];d[j]:=k;
s:=c[i];c[i]:=c[j];c[j]:=s;
end;
if (t[i]=t[j])and(c[i]>c[j]) then begin
s:=c[i];
c[i]:=c[j];
c[j]:=s;
end;
end;
for i:=1 to n do
begin
write(g,c[i],' went out at time ');
if time<t[i] then begin write(g,t[i]);time:=t[i]+d[i];end
else begin write(g,time);time:=time+d[i];end;
writeln(g);
end;
close(f);
close(g);
end.