记录编号 65098 评测结果 AAAAAT
题目名称 [暑假培训2012] 黑叔 最终得分 83
用户昵称 Gravatar铁策 是否通过 未通过
代码语言 Pascal 运行时间 1.022 s
提交时间 2013-07-25 16:01:53 内存使用 3.03 MiB
显示代码纯文本
program P935;
var
d:array[1..10000] of longint;
t1:array[1..100000] of longint;
c:array[1..10000] of string;
i,j,k,l,n,tim,y:longint;
q:string;
w:char;
begin
assign(input,'hey.in');
reset(input);
assign(output,'hey.out');
rewrite(output);
readln(n);
for i:=1 to n do
begin
  read(t1[i]);
  read(w); read(w);
  while w<>' ' do
  begin
    c[i]:=c[i]+w;
    read(w);
  end;
  readln(d[i]);
end;
for i:=1 to n-1 do
for j:=i+1 to n do
if (t1[i]>t1[j])or((t1[i]=t1[j])and(c[i]>c[j])) then begin
 y:=t1[i]; t1[i]:=t1[j]; t1[j]:=y;
q:=c[i]; c[i]:=c[j]; c[j]:=q;
y:=d[i]; d[i]:=d[j]; d[j]:=y;
end;
tim:=0;
for i:=1 to n do
  if tim>t1[i] then begin writeln(c[i],' went out at time ',tim); tim:=tim+d[i] end
  else begin writeln(c[i],' went out at time ',t1[i]); tim:=t1[i]+d[i]; end;
end.