/ SB域 /

记录详情

Accepted

/usr/bin/ld.bfd: warning: /out/link.res contains output sections; did you forget -T?
# 状态 耗时 内存占用
#1 Accepted 24ms 256.0 KiB
#2 Accepted 26ms 256.0 KiB
#3 Accepted 20ms 256.0 KiB
#4 Accepted 14ms 256.0 KiB
#5 Accepted 22ms 256.0 KiB
#6 Accepted 24ms 256.0 KiB
#7 Accepted 21ms 256.0 KiB
#8 Accepted 19ms 256.0 KiB
#9 Accepted 23ms 256.0 KiB
#10 Accepted 15ms 256.0 KiB

代码

var  s:string;
     a,time,next:array[1..3000]of longint;
     i,n,k,id,t,j,min,tt:longint;
procedure qsort(l,r:longint);
var t,i,j,mid,midt:longint;
begin
i:=l; j:=r;
mid:=a[(l+r)div 2];
midt:=time[(l+r)div 2];
while i<j do
begin
 while (a[i]<mid) do inc(i);
 while (a[j]>mid) do dec(j);
 if i<=j then begin
   t:=a[i]; a[i]:=a[j]; a[j]:=t;
   t:=time[i]; time[i]:=time[j]; time[j]:=t;
   t:=next[i]; next[i]:=next[j]; next[j]:=t;
   inc(i);dec(j);
 end;
end;
if l<j then qsort(l,j);
if r>i then qsort(i,r);
end;
begin
 while true do begin
  readln(s);
  if s='#' then break;
  inc(i);
  delete(s,1,pos(' ',s));
  val(copy(s,1,pos(' ',s)-1),ID);
  delete(s,1,pos(' ',s));
  val(s,t);
  a[i]:=ID;
  time[i]:=t;
  next[i]:=t;
 end;
 n:=i;
 qsort(1,n);
 readln(k);
 for i:=1 to k do begin
  min:=maxlongint;
  for j:=1 to n do if next[j]<min then min:=next[j];
  for j:=1 to n do if next[j]=min then begin
  writeln(a[j]);
  next[j]:=next[j]+time[j];
  inc(tt);
   if tt=k then begin
    close(input);
    close(output);
    halt;
   end;
  end;
 end;
 close(input);
 close(output);
end.

信息

递交者
类型
递交
题目
桐桐的新闻系统
题目数据
下载
语言
Pascal
递交时间
2017-08-22 16:10:23
评测时间
2017-08-22 16:10:23
评测机
分数
100
总耗时
212ms
峰值内存
256.0 KiB