Submission #1156707


Source Code Expand

program j01;
var t:array[0..100086]of longint;
    n,x,k,r,l,i,ans,tmp,c:longint;

procedure qsort(l,r:longint);
var i,j,x,y:longint;
begin
  i:=l;j:=r;x:=t[(i+j)div 2];
  repeat
    while t[i]<x do inc(i);
    while x<t[j] do dec(j);
    if i<=j then
    begin
      y:=t[i];t[i]:=t[j];t[j]:=y;
      inc(i);dec(j);
    end;
  until i>j;
  if i<r then qsort(i,r);
  if l<j then qsort(l,j);
end;

begin
  readln(n,c,k);
  for i:=1 to n do readln(t[i]);
  qsort(1,n);l:=1;
  inc(n);t[n]:=maxlongint;
  for i:=2 to n do
  begin
    while t[i]-t[l]>k do
    begin
      inc(ans);tmp:=c;
      while (l<=i-1)and(tmp>0) do
      begin
        inc(l);dec(tmp);
      end;
    end;
  end;
  writeln(ans);
end.

Submission Info

Submission Time
Task A - Airport Bus
User oldjang
Language Pascal (FPC 2.6.2)
Score 300
Code Size 740 Byte
Status AC
Exec Time 25 ms
Memory 512 KB

Compile Error

/usr/bin/ld.bfd: warning: ./link.res contains output sections; did you forget -T?

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 12
Set Name Test Cases
Sample sample1.txt, sample2.txt
All sample1.txt, sample2.txt, in1.txt, in2.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, sample1.txt, sample2.txt
Case Name Status Exec Time Memory
in1.txt AC 1 ms 128 KB
in2.txt AC 25 ms 512 KB
in3.txt AC 25 ms 512 KB
in4.txt AC 25 ms 512 KB
in5.txt AC 1 ms 128 KB
in6.txt AC 25 ms 512 KB
in7.txt AC 21 ms 384 KB
in8.txt AC 25 ms 512 KB
sample1.txt AC 0 ms 128 KB
sample2.txt AC 0 ms 128 KB