1252021-01-16 15:00:21mraronUtazásszervezés (75 pont)pascalAccepted 75/754ms2916 KiB
Program szervezo;
  const maxn=10;
        maxc=10000;
  var n,k,m,c: integer;
      ig: array[1..maxc] of integer;
      sor: array[1..maxn] of integer;
      se,su,sdb,db: integer;
      i: integer;
begin
  readln(n,k,m,c);
  for i:=1 to c do read(ig[i]);
  readln;
  sdb:=0; se:=1; su:=0; db:=0;
  for i:=1 to c do  
  begin
    while (sdb>0) and (sor[se]<ig[i]) do
    begin
      inc(se); 
      if se>n then se:=1;
      dec(sdb);
    end;
    if sdb<n then
    begin
      inc(su); 
      if su>n then su:=1;
      inc(sdb);
      sor[su]:=ig[i]+m-1;
      inc(db);
    end;
  end;
  writeln(db);
end.
2 10 4 6
1 2 2 5 6 7
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms1272 KiB
2Accepted0/04ms1552 KiB
3Accepted3/32ms1764 KiB
4Accepted4/42ms1972 KiB
5Accepted4/42ms2184 KiB
6Accepted4/42ms2312 KiB
7Accepted4/42ms2468 KiB
8Accepted4/42ms2312 KiB
9Accepted5/52ms2600 KiB
10Accepted5/53ms2632 KiB
11Accepted6/63ms2796 KiB
12Accepted6/63ms2812 KiB
13Accepted6/63ms2760 KiB
14Accepted6/64ms2632 KiB
15Accepted6/64ms2760 KiB
16Accepted6/64ms2888 KiB
17Accepted6/64ms2916 KiB