Problem:


Score : 300 points

Problem Statement

Every day, N passengers arrive at Takahashi Airport.
The i-th passenger arrives at time T_i.

Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers.
Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport.
Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane.
For that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive).

When setting the departure times for buses under this condition, find the minimum required number of buses.
Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time.

Constraints

2 \leq N \leq 100000

1 \leq C \leq 10^9

1 \leq K \leq 10^9

1 \leq T_i \leq 10^9

C, K and T_i are integers.

Input

The input is given from Standard Input in the following format:

N C K
T_1
T_2
:
T_N

Output

Print the minimum required number of buses.

Sample Input 1

5 3 5
1
2
3
6
12

Sample Output 1

3

For example, the following three buses are enough:

A bus departing at time 4.5, that carries the passengers arriving at time 2 and 3.

A bus departing at time 6, that carries the passengers arriving at time 1 and 6.

A bus departing at time 12, that carries the passenger arriving at time 12.

Sample Input 2

6 3 3
7
6
2
8
10
6

Sample Output 2

3



Sample input:
5 3 5
1
2
3
6
12


Sample output:
3

Submission status: Wrong Answer

Solution code:
n,c,k = map(int, input().split())
t = [int(input()) for _ in range(n)]
t.sort()
x = ""
cnt = 0
ans = 0
for i in range(n):
  if x == "": x = t[i]+k
  if x > t[i]: cnt += 1
  else:
    cnt = 1
    ans += 1
    x = t[i]+k
  if cnt == c:
    cnt = 0
    ans += 1
    x = ""
  if i == n-1 and cnt != 0:
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
from math import ceil

N,C,K = map(int,input().split())
T = [int(input()) for _ in range(N)]

T.sort()

ans = ceil(N/C)

for i in range(N-1):
    if T[i+1] - T[i] >= K:
        ans += 1


print(ans)

Submission status: Wrong Answer

Solution code:
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
# from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint

INF = float("inf")

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    # lsはソート済みであること
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

def I():
    return int(input())

def MI():
    return map(int,input().split())

def RI():
    return list(map(int,input().split()))

def CI(n):
    return [ int(input()) for _ in range(n) ]

def LI(n):
    return [ list(map(int,input().split())) for _ in range(n) ]

def S():
    return input()

def MS():
    return input().split()

def RS():
    return list(input().split())

def CS(n):
    return [ input() for _ in range(n) ]

def LS(n):
    return [ list(input().split()) for _ in range(n) ]

n,c,k = MI()
T = CI(n)

ls = []
for i in range(n):
    s = T[i]
    e = T[i] + k
    ls.append( [s,e] )

ls = mysort(ls,1,False)

bt = -1*INF
count = 0
for i in range(n):
    s = ls[i][0]
    t = ls[i][1]
    if s>=bt:
        count += 1
        bt = t
    else:
        pass
    
print(count)

Submission status: Wrong Answer

Solution code:
N,C,K = [int(hoge) for hoge in input().split()]
ans = 0
time = -float("inf")
bus = 0
Ts = sorted([int(input()) for i in range(N)])
for T in Ts:
    if (T > time + K) or bus==C:
        ans += 1
        time = T
        bus = 1
    else:
        bus += 1
    print(time,bus)
print(ans)

Submission status: Wrong Answer

Solution code:
N, C, K = map(int, input().split())
T = sorted([int(input()) for i in range(N)])
b = 0
i = 0
n = 0
while i < N - 1:
    t = T[i]
    k = 1
    if n + 1 == C:
        b += 1
        n = 0
        i += 1
        continue
    if t + K < T[i + 1]:
        b += 1
        n = 0
        i += 1
        continue
    n += 1
    i += 1
print(b + 1)

Submission status: Wrong Answer

Solution code:
N,C,K=list(map(int,input().split()))
import sys
l=[r.rstrip() for r in sys.stdin.readlines()]
l=list(map(int,l))
l.sort()
ans=0
from collections import deque
l=deque(l)
for j in range(N):
   A=l.popleft()
   if l != deque([]):
      B=l[0]
   else:
      B=0
   for i in range(C-1):
      if A <= B <= A+K:
         B = l.popleft()
         if l == deque([]):
            break
   ans+=1
   if l == deque([]):
      break
print(ans)

Submission status: Wrong Answer

Solution code:
n , c , k = map(int,input().split()) # n人数、cバスに乗れる数、k怒り出す時間
t = [int(input()) for _ in range(n)]

#n,c,k = 6,3,3
#t = [7,6,2,8,10,6]

t = sorted(t)

jyokyaku = 0
bus = 0
for i in t:

  if jyokyaku == 0: #バス最初の乗客
    bus += 1
    angrytime = i + k
    jyokyaku += 1
  else: 
    if i <= angrytime: #最初の乗客がキレる前だったら乗れる
      jyokyaku += 1
      if jyokyaku == c: #定員になりバス出発
        jyokyaku = 0

    else: #もうバス出発してたので最初の乗客になった
      bus += 1
      jyokyaku = 1
      angrytime = i + k

print(bus)

Submission status: Wrong Answer

Solution code:
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

n,c,k = MI()
t = sorted([I() for _ in range(n)])

cnt = 1
b = 1
bt = t[0]+k
for i in range(1, n):
    if cnt == c or t[i] > bt:
        b += 1
        bt = t[i]+k
        cnt = 0
    else:
        cnt += 1
print(b)

Submission status: Wrong Answer

Solution code:
N, C, K = map(int, input().split())
p = 0
bus = 1
b = sorted([int(input()) for i in range(N)])
for i in range(N):
    a = b[i]
    if p == 0:
        time = a
        bus += 1
    p += 1
    if time - a > K or p == C:
        p = 0
print(bus)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# sys.stdin.readline()
import numpy as np
import sys
import math
input = sys.stdin.readline
n,c,k = map(int,input().split())
A = [int(input()) for i in range(n)]
a = sorted(A)
ans = 0
time = 0.1 
num = 0
for i in range(n):
    if ans == 0:
        ans +=1
        time = a[0] -0.1
        num +=1
    elif ans != 0 and a[i] < time +k and num < c :
        num +=1
    elif  ans != 0 and (c <=num  or  time +k <=a[i]):
      
        time = a[i] -0.1
        num = 1
        ans +=1
print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# sys.stdin.readline()
import numpy as np
import sys
import math
input = sys.stdin.readline
n,c,k = map(int,input().split())
A = [int(input()) for i in range(n)]
a = sorted(A)
ans = 0
time = 0.1 
num = 0
for i in range(n):
    if ans == 0:
        ans +=1
        time = A[0]
        num +=1
    elif ans != 0 and a[i] < time +k and num < c :
        num +=1
    elif  ans != 0 and (c <=num  or  time +k <=a[i]):
      
        time = a[i] +0.1
        num = 1
        ans +=1
print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# sys.stdin.readline()
import numpy as np
import sys
import math
input = sys.stdin.readline
n,c,k = map(int,input().split())
A = [int(input()) for i in range(n)]
a = sorted(A)
ans = 1
time = 0.1 
num = 0
for i in range(n):
    if a[i] < time +k and num < c :
        num +=1
    elif  c <=num  or  time +k <=a[i]:
      
        time = a[i] +0.1
        num = 1
        ans +=1
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def printlist(lst, k='\n'): print(k.join(list(map(str, lst))))
INF = float('inf')

def solve():
    n, c, k = MI()

    T = [-1] * n
    for i in range(n):
        T[i] = II()
    T = sorted(T)

    bus_cnt = 1
    person_cnt = 0
    th = T[0] + k
    for i in T:
        # print(i, th, bus_cnt, person_cnt)
        if i <= th:
            if person_cnt + 1 > c:
                bus_cnt += 1
                th = i + k
                person_cnt = 1
            else:
                person_cnt += 1
        else:
            bus_cnt += 1
            person_cnt += 1
            th = i + k
    print(bus_cnt)

if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
# A - Airport Bus

N, C, K = map(int, input().split())
T = [int(input()) for i in range(N)]
T.sort()
ans = 0
c = 0
dead_time = 0

for i in range(N):
    if c==0 or T[i]>dead_time:
        dead_time = T[i]+K
        ans += 1
    c = (c+1)%C

print(ans)

Submission status: Wrong Answer

Solution code:
N,C,K=map(int,input().split())
T=[int(input())for i in range(N)]
T.sort()
ans=0
bus_seat=0
tmp_time=0
for i in range(len(T)):
    if T[i]>=tmp_time+K:
        bus_seat=0
    if bus_seat==0:
        ans+=1
        tmp_time=T[i]
    
    bus_seat+=1
    if bus_seat==C:
        bus_seat=0
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import re
import math
import collections
import decimal
import bisect
import itertools
import fractions
import functools
import copy
import heapq
import decimal

sys.setrecursionlimit(10000001)
INF = sys.maxsize
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===
def main():
    n, c, k = ns()
    t = [ni() for _ in range(n)]
    t.sort()

    ans = 0
    idx = 0
    while idx > n - 1:
        ans += 1

        k_idx = bisect.bisect_right(t, t[idx] + k)
        c_idx = idx + c

        idx = min(k_idx, c_idx)

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n, c, k = map(int, input().split())
t = [int(input()) for i in range(n)]
t.sort()
cnt = 1
buss = 0
fir = t[0]
for i in range(1, n):
    if fir <= t[i] and t[i] <= fir + k and cnt <= c:
        cnt += 1
    else:
        buss += 1
        cnt = 1
        fir = t[i]
if cnt >= 1:
    buss += 1
print(buss)

Submission status: Wrong Answer

Solution code:
n,c,k=map(int,input().split())
t=[]
for _ in range(n):
    t.append(int(input()))
t.sort()

def bus(M):
    j=1
    count=0
    I=t[0]
    for i in range(n):
        if I+k>=t[i] and count<c: 
            count+=1
        else:
            I=t[i]
            count=0
            j+=1
    if j<=M:
        return True
    else:
        return False

start=0
end=n
while end-start>1:
    ty=(start+end)//2
    if bus(ty):
        end=ty
    else:
        start=ty
print(end)

Submission status: Wrong Answer

Solution code:
n, c, k = map(int, input().split())
t = [int(input()) for _ in range(n)]
t.sort()

t_crr = t[0]
cnt = 0
ans = 1

for i in t:
    # print(cnt, ans, t_crr, i)
    if i - t_crr <= k and cnt < c:
        cnt += 1
        continue
    else:
        ans += 1
        cnt = 1

print(ans)

Submission status: Wrong Answer

Solution code:


n, c, k = map(int, input().split())
t = [int(input()) for _ in range(n)]
t.sort(reverse=True)

t_b = t[0]
cnt = 0
ans = 0

for i in t:
    print(i, t_b, cnt, ans)
    if t_b - i <= k and cnt + 1 <= c: # 差がk以下で人数に余裕がある
        cnt += 1
        continue
    else:
        t_b = i
        cnt = 1
        ans += 1

print(ans + 1)

Submission status: Wrong Answer

Solution code:
import bisect
from collections import Counter
import math

n, c, k = map(int, input().split())
t = [int(input()) for _ in range(n)]
t.sort()

t_limit = []
for i in range(n):
    t_limit.append(t[i] + k)

cnt = 0
ans_l = []

for i in t_limit:
    ans_l.append(bisect.bisect_right(t, i))

a = Counter(ans_l)
a = a.values()

plus = 0
for j in a:
    if j > c:
        plus += (math.floor(j/c))

# print(ans_l)
print(len(a) + plus)

Submission status: Wrong Answer

Solution code:
import bisect
from collections import Counter
import math

n, c, k = map(int, input().split())
t = [int(input()) for _ in range(n)]
t.sort()

t_limit = []
for i in range(n):
    t_limit.append(t[i] + k)

cnt = 0
ans_l = []

for i in t_limit:
    ans_l.append(bisect.bisect_left(t, i+1))

a = Counter(ans_l)
a = a.values()

plus = 0
for j in a:
    if j > c:
        plus += (math.floor(j/c))

print(len(a) + plus)

Submission status: Wrong Answer

Solution code:
import bisect
from collections import Counter
import math

n, c, k = map(int, input().split())
t = [int(input()) for _ in range(n)]
t.sort()

t_limit = []
for i in range(n):
    t_limit.append(t[i] + k)

cnt = 0
ans_l = []

for i in t_limit:
    ans_l.append(bisect.bisect_left(t, i))

a = Counter(ans_l)
a = a.values()

plus = 0
for j in a:
    if j > c:
        plus += (math.floor(j/c))

print(len(a) + plus)

Submission status: Wrong Answer

Solution code:
import bisect

n, c, k = map(int, input().split())
t = [int(input()) for _ in range(n)]
t.sort()

t_limit = []
for i in range(n):
    t_limit.append(t[i] + k)

cnt = 0
ans_l = []

for i in t_limit:
    ans_l.append(bisect.bisect_left(t, i))

print(len(set(ans_l)))

Submission status: Wrong Answer

Solution code:
N,C,K = map(int,input().split())
T = [int(input()) for _ in range(N)]
T.sort()
bus = 0
count = 0
j = 0
for i in range(N):
  count += 1
  if count >= C or T[i-1] >= T[j]+K:
    bus += 1
    j += count
    count = 0
  if i == N-1:
    if count%C == 0:
      bus += count//C
    else:
      bus += count//C+1
print(bus)

Submission status: Wrong Answer

Solution code:
from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N,C,K = list(map(int,_in[0].split(' ')))  # type:list(int)
    T_arr = []
    for i in range(N):
        _ = int(_in[i+1])  # type:int
        T_arr.append(_)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    cnt = 0
    i = 0
    while True:
        c = 1
        tlim = T_arr[i]+K
        i += 1
        while i<N-1 and T_arr[i]<=tlim and c+1<=C:
            i += 1
            c += 1
        cnt += 1
        if i>=N:
            break
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)

Submission status: Wrong Answer

Solution code:
from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N,C,K = list(map(int,_in[0].split(' ')))  # type:list(int)
    T_arr = []
    for i in range(N):
        _ = int(_in[i+1])  # type:int
        T_arr.append(_)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    cnt = 0
    i = -1
    c = 1
    while True:
        i += 1
        t = T_arr[i]
        while i<N-1 and t+K>=T_arr[i] and c+1<=C:
            i += 1
            c += 1
        else:
            c %= C
        cnt += 1
        if i>=N-1:
            break
    cnt += 1
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)

Submission status: Wrong Answer

Solution code:
from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N,C,K = list(map(int,_in[0].split(' ')))  # type:list(int)
    T_arr = []
    for i in range(N):
        _ = int(_in[i+1])  # type:int
        T_arr.append(_)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    cnt = 0
    i = -1
    c = 1
    while True:
        i += 1
        t = T_arr[i]
        while i<N-1 and t+K>=T_arr[i] and c+1<=C:
            print(i,c,T_arr[i],t+K)
            i += 1
            c += 1
        else:
            c %= C
        cnt += 1
        if i>=N-1:
            break
    else:
        cnt += 1
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)

Submission status: Wrong Answer

Solution code:
n, c, k = map(int, input().split())
t = [int(input()) for _ in range(n)]
t.sort()
ans = 1
bus = t[0]+k
people = 0
for i in range(1, n):
    if t[i] < bus:
        if people <= c:
            people += 1
        else:
            ans +=1
            people = 1
    else:
        ans += 1
        people = 0
        bus = t[i]+k
print(ans)

Submission status: Wrong Answer

Solution code:
n, c, k = map(int, input().split())
t = [int(input()) for _ in range(n)]

t.sort()

waitP = 1
l = t[0]
r = t[0]
ans = 0

for i in range(1, n):
    if waitP == c:
        ans += 1
        l = t[i]
        waitP = 1
    elif waitP != c:
        if t[i] - l <= k:
            waitP += 1
            if i == n - 1:
                ans += 1
        elif t[i] - l > k:
            ans += 1
            l = t[i]
            waitP = 1
            if i == n - 1:
                ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
n, c, k = map(int, input().split())
t = [int(input()) for _ in range(n)]

t.sort()

waitP = 1
l = t[0]
r = t[0]
ans = 0

for i in range(1, n):
    if waitP == c:
        ans += 1
        l = t[i]
        waitP = 1
    elif waitP != c:
        if t[i] - l < k:
            waitP += 1
            if i == n - 1:
                ans += 1
        elif t[i] - l >= k:
            ans += 1
            l = l + k
            waitP = 1
            if i == n - 1:
                ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
n, c, k = map(int, input().split())
t = [int(input()) for _ in range(n)]

t.sort()

waitP = 1
l = t[0]
r = t[0]
ans = 0

for i in range(1, n):
    if waitP == c:
        ans += 1
        l = t[i]
        waitP = 1
    elif t[i] - l < k:
        waitP += 1
        if i == n - 1:
            ans += 1
    elif t[i] - l >= k:
        ans += 1
        l = t[i]
        waitP = 1
        if i == n - 1:
            ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
N, C, K, *T = map(int, open(0).read().split())
T.sort()

ans = 1
curm = T[0]
curc = 0
for t in T:
    curc += 1
    if t > curm+K or curc == C:
        ans += 1
        curm = t
        curc = 1

print(ans)

Submission status: Wrong Answer

Solution code:
N, C, K, *T = map(int, open(0).read().split())
T.sort()

ans = 1
curm = T[0]
curc = 0
for t in T:
    curc += 1
    if curc > C:
        curc = 1
        ans += 1
        curm = t
    elif t > curm+K:
        ans += 1
        curm = t

print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    N, C, K = (int(i) for i in input().split())
    T = [int(input()) for i in range(N)]
    ans = 0
    deadline = 0
    cur = 0
    for t in T:
        if cur == 0:
            deadline = t + C
            cur += 1
            continue
        if cur < K and t <= deadline:
            cur += 1
        else:
            ans += 1
            cur = 1
            deadline = t + C
    ans += 1
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N, C, K = (int(i) for i in input().split())
    T = [int(input()) for i in range(N)]
    ans = 0
    deadline = 0
    cur = 0
    for t in T:
        if cur == 0:
            deadline = t + C
            cur += 1
            continue
        if cur < K and t <= deadline:
            cur += 1
        else:
            ans += 1
            cur = 1
            deadline = t
    ans += 1
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N, C, K = map(int, input().split())
bus_count = 0
waiting_count = 0
time_limit = 0
D = [int(input()) for _ in range(N)]
D.sort()
# C == 1の場合にあロジックが崩壊してしまうわ
for i in range(N):
    T = D[i]
    waiting_count += 1
    if waiting_count == C:
        bus_count += 1
        waiting_count = 0
        time_limit = 0
    else:
        if waiting_count == 1:
            time_limit = T + K
        else:
            if T > time_limit:
                time_limit = T + K
                bus_count += 1
                waiting_count = 1


if not waiting_count == 0:
    print(bus_count+1)
else:
    print(bus_count)

Submission status: Wrong Answer

Solution code:
N, C, K = map(int, input().split())
bus_count = 0
waiting_count = 0
time_limit = 0
D = [int(input()) for _ in range(N)]
D.sort()
for i in range(N):
    T = D[i]
    waiting_count += 1
    if waiting_count == 1:
        time_limit = T + K
    else:
        if T > time_limit:
            time_limit = T + K
            bus_count += 1
            waiting_count = 1
        if waiting_count == C:
            bus_count += 1
            waiting_count = 0
            time_limit = 0

if not waiting_count == 0:
    print(bus_count+1)
else:
    print(bus_count)

Submission status: Wrong Answer

Solution code:
N, C, K = map(int, input().split())
bus_count = 0
waiting_count = 0
time_limit = 0
D = [int(input()) for _ in range(N)]
D.sort()
for i in range(N):
    T = D[i]
    waiting_count += 1
    if waiting_count == 1:
        time_limit = T + K
    else:
        if T > time_limit:
            time_limit = T + K
            bus_count += 1
            waiting_count = 1
        if waiting_count == C:
            bus_count += 1
            waiting_count = 0
            time_limit = 0

if waiting_count > 0:
    print(bus_count+1)
else:
    print(bus_count)

Submission status: Wrong Answer

Solution code:
N, C, K = map(int, input().split())
bus_count = 0
waiting_count = 0
time_limit = 0
D = [int(input()) for _ in range(N)]
D.sort()
for i in range(N):
    T = D[i]
    waiting_count += 1
    if waiting_count == 1:
        time_limit = T + K
    else:
        if T > time_limit:
            time_limit = T + K
            bus_count += 1
            waiting_count = 1
        if waiting_count == C:
            bus_count += 1
            waiting_count = 0
            time_limit = 0

print(bus_count+1)

Submission status: Wrong Answer

Solution code:
N, C, K = map(int, input().split())
bus_count = 0
waiting_count = 0
time_limit = 0
D = [int(input()) for _ in range(N)]
for i in range(N):
    T = D[i]
    waiting_count += 1
    if waiting_count == 1:
        time_limit = T + K
    else:
        if T > time_limit:
            time_limit = T + K
            bus_count += 1
            waiting_count = 1
        if waiting_count == C:
            bus_count += 1
            waiting_count = 0
            time_limit = 0

print(bus_count+1)

Submission status: Wrong Answer

Solution code:
N, C, K = map(int, input().split())
bus_count = 0
waiting_count = 0
time_limit = 0
for _ in range(N):
    T = int(input())
    waiting_count += 1
    if waiting_count == 1:
        time_limit = T + K
    else:
        if T > time_limit:
            time_limit = T + K
            bus_count += 1
            waiting_count = 1
        if waiting_count == C:
            bus_count += 1
            waiting_count = 0
            time_limit = 0

print(bus_count+1)

Submission status: Wrong Answer

Solution code:
N, C, K = map(int, input().split())
bus_count = 0
waiting_count = 0
time_limit = 0
for _ in range(N):
    T = int(input())
    waiting_count += 1
    if waiting_count == 1:
        time_limit = T + K
    else:
        if T > time_limit:
            time_limit = T + K
            bus_count += 1
            waiting_count = 1
        if waiting_count == 3:
            bus_count += 1
            waiting_count = 0
            time_limit = 0

print(bus_count+1)

Submission status: Wrong Answer

Solution code:
N, C, K = map(int, input().split())
bus_count = -1
waiting_count = 0
time_limit = -1
for _ in range(N):
    T = int(input())
    if time_limit < T:
        bus_count += 1
        waiting_count = 0
        time_limit = 0
    waiting_count += 1
    if waiting_count == 1:
        time_limit = T + K
    elif waiting_count == 3:
        bus_count += 1
        waiting_count = 0
        time_limit = 0
print(bus_count)

Submission status: Wrong Answer

Solution code:
N,C,K = map(int, input().split())
L = [int(input()) for i in range(N)]
L.sort()
cap = 0
begin = 0
count = 1

for i in range(N):
  a = L[i]
  if begin == 0:
    begin = a
  elif a <= begin + K and cap < C:
    cap += 1
  else:
    cap = 1
    begin = a
    count += 1
print(count)

Submission status: Wrong Answer

Solution code:
N,C,K = map(int, input().split())
L = [int(input()) for i in range(N)]
cap = 0
begin = 0
count = 1

for i in range(N):
  a = L[i]
  if begin == 0:
    begin = a
  elif a <= begin + K and cap < C:
    cap += 1
  else:
    cap = 1
    begin = a
    count += 1
print(count)

Submission status: Wrong Answer

Solution code:
N,C,K = map(int, input().split())
L = [int(input()) for i in range(N)]
cap = 0
begin = 0
count = 1

for i in range(N):
  a = L[i]
  if begin == 0:
    begin = a
  elif a <= begin + K and cap < C:
    count += 1
  else:
    cap = 1
    begin = a
    count += 1
print(count)

Submission status: Wrong Answer

Solution code:
N,C,K = map(int, input().split())
L = [int(input()) for i in range(N)]
cap = 0
begin = 0
count = 1

for i in range(N):
  a = L[i]
  if begin == 0:
    begin = a
  elif a < begin + K and cap < C:
    count += 1
  else:
    cap = 1
    begin = a
    count += 1
print(count)

Submission status: Wrong Answer

Solution code:
N, C, K = map(int,input().split())
T = [int(input()) for i in range(N)]
T.sort()
counter = 0
i = 0
while i<N:
    for j in range(i+C-N,C):
        if T[i]+K >= T[i+(C-j-1)]:
            counter += 1
            i = i+(C-j-1)+1
            break
print(counter)

Submission status: Wrong Answer

Solution code:
N,C,K = map(int,input().split())
T = sorted([int(input()) for i in range(N)])
Ti = T[0]
p = 0
ans = 1
for t in T:
    p+=1
    if p==C or t>Ti+K:
        ans+=1
        p=0
        Ti=t
print(ans)

Submission status: Wrong Answer

Solution code:

import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

n, c,k = map(int, input().split())
t = list(int(input()) for i in range(n))
t.sort()
ans =0

from collections import deque
queue = deque()
queue.append(t[0])
limit = t[0]+k

INF = float('inf')
t.append(INF)

for i in range(1,n):

    queue.append(t[i])
    limit = queue[0]+k

    if limit < t[i+1] or len(queue)>=c:
        for i in range(min(len(queue), c)):
            queue.popleft()
        ans += 1

while queue:
    for i in range(min(len(queue), c)):
        queue.popleft()
    ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

n, c,k = map(int, input().split())
t = list(int(input()) for i in range(n))
t.sort()
ans =0

from collections import deque
queue = deque()
queue.append(t[0])
limit = t[0]+k

INF = float('inf')
t.append(INF)

for i in range(1,n):

    if not len(queue):
        limit = t[i]+k

    queue.append(t[i])

    if limit < t[i+1] or len(queue)>=c:
        for i in range(min(len(queue), c)):
            queue.popleft()
            limit = None
        ans += 1

        if len(queue):
            limit = queue[0]+k

while queue:
    for i in range(min(len(queue), c)):
        queue.popleft()
    ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
n, c, k = [int(a) for a in input().split()]
t = []
for _ in range(n):
    t.append(int(input()))
t = np.asarray(t)
t = np.sort(t)
limit = t + k

ans = 0
count = 0
lim = 0
for i in range(t.shape[0]):
    count += 1
    if count == c:
        ans += 1
        count = 0
        # print("bus", t[i])
    elif count == 1:
        lim = limit[i]
    elif t[i] > lim:
        ans += 1
        count = 1
        lim = limit[i]
        # print("bus", t[i-1])
    if i == (t.shape[0] -1):
        ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
n, c, k = [int(a) for a in input().split()]
t = []
for _ in range(n):
    t.append(int(input()))
t = np.asarray(t)
t = np.sort(t)
limit = t + k

ans = 0
for i in range(t.shape[0]):
    if t[i] == -1:
        continue
    
    lim = limit[i]
    count = 1
    # joukyaku = []
    for j in range(t.shape[0]):
        if t[j] != -1 and t[j] <= lim and count <= 3:
            # joukyaku.append(t[j])
            t[j] = -1
            count += 1
    # print("bus", joukyaku)
    ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
n, c, k = [int(a) for a in input().split()]
t = []
for _ in range(n):
    t.append(int(input()))
t = np.asarray(t)
t = np.sort(t)
limit = t + k

ans = 0
count = 0
lim = 0
for i in range(t.shape[0]):
    count += 1
    if count == 3:
        ans += 1
        count = 0
        # print("bus", t[i])
    elif count == 1:
        lim = limit[i]
    elif t[i] > lim:
        ans += 1
        count = 1
        lim = limit[i]
        # print("bus", t[i-1])
    if i == (t.shape[0] - 1):
        ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
n, c, k = [int(a) for a in input().split()]
t = []
for _ in range(n):
    t.append(int(input()))
t = np.asarray(t)
t = np.sort(t)
limit = t + k

ans = 1
count = 1
for i in range(1, t.shape[0]):
    count += 1
    if limit[i-1] < t[i] or count >= 3:
        # print("!", t[i])
        count = 0
        ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
n , c , k = map(int,input().split())
t = [int(input()) for i in range(n)]
t.sort()

ans = 0
cou = 0
lim = 0
print(t)
for i in range(n):
    if lim == 0:
        lim = t[i] + k
        cou = 1
        if c == 1:
            lim = 0
            cou = 0
            ans += 1
    elif lim > t[i]:
        if cou == c - 1:
            ans += 1
            cou = 0
            lim = 0
        elif cou < c - 1:
            cou += 1
    elif lim == t[i]:
        ans += 1
        cou = 0
        lim = 0
    elif lim < t[i]:
        ans += 1
        cou = 1
        lim = t[i] + k

if cou > 0:
    ans += 1

print(ans)