记录编号 65543 评测结果 AAAAAT
题目名称 [暑假培训2012] 黑叔 最终得分 83
用户昵称 Gravatarcuizhongyu 是否通过 未通过
代码语言 Pascal 运行时间 1.023 s
提交时间 2013-07-26 17:40:11 内存使用 2.68 MiB
显示代码纯文本
var
n,i,j,k,l:longint;
f:string;
q:char;
s:string;
c:array [0..10000] of string;
t,d:array[0..10000] of longint;
begin
assign(input,'hey.in');
reset(input);
assign(output,'hey.out');
rewrite(output);
readln(n);

for i:=1 to n do
begin
read(t[i]);
read(q);read(q);
s:='';
while q<>' ' do
begin
s:=s+q;
c[i]:=s;
read(q);
end;
read(d[i]);
 end;

for i:=1 to n do
for j:=i+1 to n do
begin
 if t[i]=t[j] then
  if c[i][1]>c[j][1]
  then
   begin
   k:=t[i];  t[i]:=t[j];  t[j]:=k;
   f:=c[i]; c[i]:=c[j]; c[j]:=f;
   k:=d[i]; d[i]:=d[j]; d[j]:=k;
   end;
 if t[i]>t[j] then begin
   k:=t[i];  t[i]:=t[j];  t[j]:=k;
   f:=c[i]; c[i]:=c[j]; c[j]:=f;
   k:=d[i]; d[i]:=d[j]; d[j]:=k;
   end;
    end;


    write(c[1],' ','went out at time',' ',t[1]);
writeln;
for i:=2 to n do
begin
 if d[i-1]+t[i-1]>t[i] then
 t[i]:=d[i-1]+t[i-1];

    write(c[i],' ','went out at time',' ',t[i]);

    writeln;

 end;
close (input);
close(output);
 end.