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 = []
for i in range(N):
    T.append(int(input()))
T.sort()
in_bus = 0
ans = 0
limit = T[0]
for i in range(N):
    if i == N-1:
        ans += 1
    else:
        if T[i]-limit > K or in_bus == C :
            ans += 1
            limit = T[i+1]
        else:
            in_bus += 1
print(ans)

Submission status: Wrong Answer

Solution code:
N, C, K = map(int, input().split())
T = []
for i in range(N):
    T.append(int(input()))
T.sort()
in_bus = 0
ans = 1
limit = T[0]
for i in range(N):
    if T[i]-limit > K or in_bus == C:
        ans += 1
        limit = T[i]
    else:
        in_bus += 1
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

N, C, K = map(int, input().split())

ps = defaultdict(int)
for i in range(N):
    T = int(input())
    ps[T] += 1

count = 0
current_ps = 0
time_limit = 10**9+K+1

for t in sorted(ps.keys()):
    if t > time_limit:
        count += 1
        current_ps = 0

    if current_ps == 0:
        time_limit = t + K

    current_ps += ps[t]
    while current_ps >= C:
        count += 1
        current_ps -= C
        time_limit = t + K

if current_ps > 0:
    count += 1

print(count)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

N, C, K = map(int, input().split())

ps = defaultdict(int)
for i in range(N):
    T = int(input())
    ps[T] += 1

count = 0
current_ps = 0
time_limit = 10**9+1

for t in sorted(ps.keys()):
    if t > time_limit:
        count += 1
        current_ps = 0

    if current_ps == 0:
        time_limit = t + K

    current_ps += ps[t]
    while current_ps >= C:
        count += 1
        current_ps -= C
        time_limit = t + K

if current_ps > 0:
    count += 1

print(count)

Submission status: Wrong Answer

Solution code:
from math import ceil

def main():
    N, C, K =list(map(int, input().split()))
    Ts = []
    for _ in range(N):
        Ts.append(int(input()))

    Ts.sort()

    bus_ct = 0
    in_bus = 1
    st = Ts.pop(0)
    for Ti in Ts:
        if Ti > st:
            bus_ct += 1
            in_bus = 1
            st = Ti + K
        elif Ti <= st:
            in_bus += 1

        if in_bus > C:
            bus_ct += 1
            in_bus = 1
            st = Ti + K
    
    if in_bus:
        bus_ct += 1
    
    print(bus_ct)

main()

Submission status: Wrong Answer

Solution code:
from math import ceil

def main():
    N, C, K =list(map(int, input().split()))
    Ts = []
    for _ in range(N):
        Ts.append(int(input()))

    Ts.sort()

    bus_ct = 0
    in_bus = 1
    st = Ts.pop(0)
    for Ti in Ts:
        if Ti > st or in_bus > C:
            bus_ct += 1
            in_bus = 1
            st = Ti + K
        elif Ti <= st:
            in_bus += 1
    
    if in_bus:
        bus_ct += 1
    
    print(bus_ct)

main()

Submission status: Wrong Answer

Solution code:
from math import ceil

def main():
    N, C, K =list(map(int, input().split()))
    Ts = []
    for _ in range(N):
        Ts.append(int(input()))

    Ts.sort()

    bus_ct = 0
    in_bus = 1
    st = Ts.pop(0)
    for Ti in Ts:
        if Ti <= st:
            in_bus += 1
        
        elif Ti > st or in_bus > C:
            bus_ct += 1
            in_bus = 1
            st = Ti + K
    
    if in_bus:
        bus_ct += 1
    
    print(bus_ct)

main()

Submission status: Wrong Answer

Solution code:
from math import ceil

def main():
    N, C, K =list(map(int, input().split()))
    Ts = []
    for _ in range(N):
        Ts.append(int(input()))

    Ts.sort()

    bus_ct = 0
    in_bus = 1
    st = Ts.pop(0)
    for Ti in Ts:
        if Ti <= st:
            in_bus += 1
        
        elif Ti > st or in_bus > C:
            bus_ct += 1
            in__bus = 1
            st = Ti + K
    
    if in_bus:
        bus_ct += 1
    
    print(bus_ct)

main()

Submission status: Wrong Answer

Solution code:
N, C, K = map(int,input().split())
T = []
for _ in range(N):
  T.append(int(input()))
sorted(T)
cnt=1
s=0
for i in range(N):
  if (T[i] > T[s]+K) or (i==s+C):
    cnt += 1
    s=i
print(cnt)

Submission status: Wrong Answer

Solution code:
N, C, K = map(int,input().split())
T = []
for _ in range(N):
  T.append(int(input()))
sorted(T)
cnt=1
s=0
for i in range(N):
  if (T[i] > T[s]+K) or (i==s+C):
    cnt += 0
    s=i
print(cnt)

Submission status: Wrong Answer

Solution code:
N,C,K = map(int,input().split())
T = [int(input()) for i in range(N)]
T.sort()
s = 0
e = T[0]+K
p = 0
ans = 0
flag = False
for i in range(N):
    if p == C or e < T[i]:
        ans += 1
        s = T[i]
        e = T[i]+K
        p = 0
        if i == N-1:
            flag = True
    s = max(s,T[i])
    e = min(e,T[i]+K)
    p += 1
if not flag:
    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()
s = 0
e = T[0]+K
p = 0
ans = 0
flag = False
for i in range(N):
    if p == C or e < T[i]:
        ans += 1
        s = T[i]
        e = T[i]+K
        p = 0
        if i == N-1:
            flag = True
    s = max(s,T[i])
    e = min(e,T[i]+K)
    p += 1
if not flag:
    ans += 1
print(ans+1)

Submission status: Wrong Answer

Solution code:
N,C,K = map(int,input().split())
T = [int(input()) for i in range(N)]
s = 0
e = T[0]+K
p = 0
ans = 0
flag = False
for i in range(N):
    if p == C or e < T[i]:
        ans += 1
        s = T[i]
        e = T[i]+K
        p = 0
        if i == N-1:
            flag = True
    s = max(s,T[i])
    e = min(e,T[i]+K)
    p += 1
if not flag:
    ans += 1
print(ans+1)

Submission status: Wrong Answer

Solution code:
N,C,K = map(int,input().split())
T = [int(input()) for i in range(N)]
s = 0
e = 0
p = 0
ans = 0
flag = False
for i in range(N):
    if p == C or e < T[i]:
        ans += 1
        s = T[i]
        e = T[i]+K
        p = 0
        if i == N-1:
            flag = True
    s = max(s,T[i])
    e = min(e,T[i]+K)
    p += 1
if not flag:
    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)]
s = 0
e = 0
p = 0
ans = 0
for i in range(N):
    if p == C or e < T[i]:
        ans += 1
        s = T[i]
        e = T[i]+K
        p = 0
    s = max(s,T[i])
    e = min(e,T[i]+K)
    p += 1
if p > 0:
    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()
cnt = 0
cur = -k
num = 1
for i in range(n):
    if t[i] >= cur + k or num == c:
        cur = t[i]
        cnt += 1
        num = 1
    else:
        num += 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()
cnt = 0
cur = -c
for i in range(n):
    if t[i] >= cur + c:
        cur = t[i]
        cnt += 1
print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,c,k=map(int,input().split())
bus=0
totalbus=0
for t in sorted([int(input())for i in range(n)]):
    if bus==0:
        time=t
        totalbus+=1
    if time<=t<=time+k:
        bus+=1
        if bus==c:
            bus=0
    else:
        bus=0
    #print(bus,totalbus,time)
if bus==0:
    totalbus+=1
print(totalbus)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,c,k=map(int,input().split())
bus=0
totalbus=0
for t in sorted([int(input())for i in range(n)]):
    if bus==0:
        time=t
        totalbus+=1
    if time<=t<=time+k:
        bus+=1
        if bus==c:
            bus=0
    else:
        bus=0
    #print(bus,totalbus,time)
print(totalbus)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,c,k=map(int,input().split())
bus=0
totalbus=0
for i in range(n):
    t=int(input())
    if bus==0:
        time=t
    if time<=t<=time+k:
        bus+=1
        if bus==c:
            bus=0
            totalbus+=1
    else:
        bus=0
        totalbus+=1
    print(bus,time)
print(totalbus)

Submission status: Wrong Answer

Solution code:
n,c,k=map(int,input().split())
bus=0
totalbus=1
for i in range(n):
    t=int(input())
    if bus==0:
        time=t
    if time<=t<=time+k:
        bus+=1
        if bus==c:
            bus=0
            totalbus+=1
    else:
        bus=0
        totalbus+=1
    print(bus,time)
print(totalbus)

Submission status: Wrong Answer

Solution code:
N,C,K=map(int, input().split())
l = []
ans = 0
for i in range(N):
    l.append(int(input()))
l.sort()
l.append(float("INF"))
l = l[::-1]
while len(l)>1:
  h=l.pop()
  i=h
  j=1
  while len(l)>1 and j<C and h+K>l[-1]:
    i=l.pop()
    j+=1
  ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
N,C,K=map(int, input().split())
l = []
ans = 0
for i in range(N):
    l.append(int(input()))
l.sort()
l = l[::-1]
l.append(float("INF"))
while len(l)>0:
  h=l.pop()
  i=h
  j=1
  while len(l)>0 and j<C and h+K>l[-1]:
    i=l.pop()
    j+=1
  ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:

N,C,K=map(int, input().split())
l = []
ans = 0
for i in range(N):
    l.append(int(input()))
l.sort()
l = l[::-1]
while l:
  h=l.pop()
  i=h
  j=1
  while l and j<C and h+K>l[-1]:
    i=l.pop()
    j+=1
  ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
N,C,K=map(int, input().split())
l = []
ans = 0
for i in range(N):
    l.append(int(input()))
while l:
  h=l.pop()
  i=h
  j=1
  while l and j<C and i-h<K:
    i=l.pop()
    j+=1
  if i-h>K:
    l.append(i)
  ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
N,C,K=map(int, input().split())
l = []
ans = 0
for i in range(N):
    l.append(int(input()))
l = l[::-1]
while l:
  h=l.pop()
  i=h
  j=1
  while l and j<C and i-h<K:
    i=l.pop()
    j+=1
  if i-h>K:
    l.append(i)
  ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
N,C,K = map(int,input().split())
Ts = sorted([int(input()) for _ in range(N)])

#print(Ts)

ans = 0
firstFlag = True
passenger = []	#limit lastNum
for i in range(N):
	if firstFlag:
		passenger = [Ts[i] + K,C-1]
		firstFlag = False
		ans += 1
		#print("first",str(passenger),Ts[i],ans)
	
	if i+1 < N and passenger[0] <= Ts[i+1]:
		#print("time over",str(passenger),Ts[i],ans)
		firstFlag = True
	elif passenger[1] <= 0:
		#print("full",str(passenger),Ts[i],ans)
		firstFlag = True
	else:
		#print("other",str(passenger),Ts[i],ans)
		passenger[1] -= 1

print(ans)

Submission status: Wrong Answer

Solution code:
N,C,K = map(int,input().split())
Ts = sorted([int(input()) for _ in range(N)])

#print(Ts)

ans = 0
firstFlag = True
passenger = []	#firstTime lastNum
for i in range(N):
	if firstFlag:
		passenger = [Ts[i],C]
		firstFlag = False
		#print("first",str(passenger),Ts[i],ans)
	
	if i+1 < N and passenger[0] + K <= Ts[i+1]:
		#print("time over",str(passenger),Ts[i],ans)
		ans += 1
		firstFlag = True
	elif passenger[1] == 1:
		#print("full",str(passenger),Ts[i],ans)
		ans += 1
		firstFlag = True
	else:
		#print("other",str(passenger),Ts[i],ans)
		passenger[1] -= 1
else:
	#print("close",str(passenger),ans)
	if not firstFlag:
		ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
N,C,K = map(int,input().split())
Ts = sorted([int(input()) for _ in range(N)])

#print(Ts)

ans = 0
firstFlag = True
passenger = []	#firstTime lastNum
for i in range(N):
	if firstFlag:
		passenger = [Ts[i],C-1]
		firstFlag = False
		#print("first",str(passenger),Ts[i],ans)
	elif i < N-1:
		if passenger[0] + K <= Ts[i+1]:
			#print("time over",str(passenger),Ts[i],ans)
			ans += 1
			firstFlag = True
	elif passenger[1] == 1:
		#print("full",str(passenger),Ts[i],ans)
		ans += 1
		firstFlag = True
	else:
		#print("other",str(passenger),Ts[i],ans)
		passenger[1] -= 1
else:
	#print("close",str(passenger),ans)
	if not firstFlag:
		ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
N,C,K = map(int,input().split())
Ts = sorted([int(input()) for _ in range(N)])

#print(Ts)

ans = 0
firstFlag = True
passenger = []	#firstTime lastNum
for i in range(N):
	if firstFlag:
		passenger = [Ts[i],C-1]
		firstFlag = False
		#print("first",str(passenger),Ts[i],ans)
	elif passenger[0] + K <= Ts[i]:
		#print("time over+first",str(passenger),Ts[i],ans)
		ans += 1
		firstFlag = True
		
		passenger = [Ts[i],C-1]
		firstFlag = False
	elif passenger[1] == 1:
		#print("full",str(passenger),Ts[i],ans)
		ans += 1
		firstFlag = True
	else:
		#print("other",str(passenger),Ts[i],ans)
		passenger[1] -= 1
else:
	#print("close",str(passenger),ans)
	if not firstFlag:
		ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
N,C,K = map(int,input().split())
Ts = sorted([int(input()) for _ in range(N)])

#print(Ts)

ans = 0
firstFlag = True
passenger = []	#firstTime lastNum
for i in range(N):
	if firstFlag:
		passenger = [Ts[i],C-1]
		firstFlag = False
		#print("first",str(passenger),Ts[i],ans)
	elif passenger[0] + K <= Ts[i]:
		#print("time over+first",str(passenger),Ts[i],ans)
		ans += 1
		firstFlag = True
		
		passenger = [Ts[i],C-1]
		firstFlag = False
	elif passenger[1] == 1:
		#print("full",str(passenger),Ts[i],ans)
		ans += 1
		firstFlag = True
	else:
		#print("other",str(passenger),Ts[i],ans)
		passenger[1] -= 1
else:
	#print("close",str(passenger),ans)
	ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
N,C,K=map(int,input().split())
if N==5 and C==3 and K==5:
  exit()
l=[]

for i in range(N):
  l.append(int(input()))

l.sort()

bus_c=0
t_lim=0
jou_c=0

for x in l:
  if t_lim==0:
    t_lim=x+K
    bus_c+=1
    jou_c+=1
  else:
    if x>t_lim or C==jou_c:
      bus_c+=1
      jou_c=1
      t_lim=x+K
    else:
      jou_c+=1

print(bus_c)

Submission status: Wrong Answer

Solution code:
N,C,K=map(int,input().split())
if N==5 and C==3 and K==5:
  exit()
l=[]

for i in range(N):
  l.append(int(input()))

l.sort()

bus_c=0
t_lim=0
jou_c=0

for x in l:
  if t_lim==0:
    t_lim=x+K
    bus_c+=1
    jou_c+=1
  else:
    if x>t_lim or C==jou_c:
      bus_c+=1
      print(x)
      jou_c=1
      t_lim=x+K
    else:
      jou_c+=1

print(bus_c)

Submission status: Wrong Answer

Solution code:
N, C, K = [int(i) for i in input().split()]
li = [int(input()) for _ in range(N)]
li.sort()

ans = 0
count = 1
a = li[0]
for i in range(1,N):
    if a+K > li[i] or count == C:
        ans += 1
        a = li[i]
        count = 0
    count += 1
print(ans+(count == C))

Submission status: Wrong Answer

Solution code:
N, C, K = [int(i) for i in input().split()]
li = [int(input()) for _ in range(N)]

ans = 0
count = 1
a = li[0]
for i in range(1,N):
    if a+K > li[i] or count == C:
        ans += 1
        a = li[i]
        count = 0
    count += 1
print(ans+(count == C))

Submission status: Wrong Answer

Solution code:
N, C, K = [int(i) for i in input().split()]
li = [int(input()) for _ in range(N)]

ans = 0
count = 0
a = li[0]
for i in range(1,N):
    if a+K > li[i] or count == C:
        ans += 1
        a = li[i]
        count = 0
    count += 1
print(ans)

Submission status: Wrong Answer

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

p = 0
b = 0
for i in range(n):
    t = T[i]
    if p == 0:
        w = t
    p += 1
    if p == c:
        b += 1
        p = 0
    elif t - w == k:
        b += 1
        p = 0
    elif t - w > k:
        b += 1
        p = 1
        w = t
    if i == n - 1 and p > 0:
        b += 1
    #print(t, w, p, b)
print(b)

Submission status: Wrong Answer

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

p = 0
w = T[0]
b = 0
for i in range(n):
    t = T[i]
    p += 1
    if p == c:
        b += 1
        p = 0
    elif t - w == k:
        b += 1
        p = 0
    elif t - w > k:
        b += 1
        p = 1
        w = t
    else:
        w = t
    if i == n - 1 and p > 0:
        b += 1
    #print(t, p, b)
print(b)

Submission status: Wrong Answer

Solution code:
n, c, k = map(int, input().split())
T = sorted([int(input()) for i in range(n)])
p = 0
cur = 0
b = 0
for i in range(n):
    at = T[i]
    p += 1
    if p == c:
        b += 1
        p = 0
    elif at - cur == k:
        b += 1
        p = 0
    elif at - cur > k:
        b += 1
        p = 1
    if i == n - 1 and p > 0:
        b += 1
    cur = at
    #print(at, p, b)
print(b)

Submission status: Wrong Answer

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

bus=0
arr=0
que=0
for i in range(n):
  tt=t[i]
  if que==0:
    print('que=0,i,bus,arr,que,t[i]',i,bus,arr,que,t[i])
    arr=tt
    que+=1
    bus+=1
  else:
    if que==c:
      #print('q==c,i,bus,arr,que,t[i]',i,bus,arr,que,t[i])
      bus+=1
      arr=tt
      que=1
    else:
      if arr+k<tt:
        #print('dep,i,bus,arr,que,t[i]',i,bus,arr,que,t[i])
        bus+=1
        arr=tt
        que=1
      else:
        #print('waiting,i,bus,arr,que,t[i]',i,bus,arr,que,t[i])
        que+=1

print(bus)

Submission status: Wrong Answer

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

bus=0
arr=0
que=0
for i in range(n):
  tt=t[i]
  if que==0:
    arr=tt
    que+=1
  else:
    if que==c:
      bus+=1
      arr=tt
      que=1
    else:
      if arr+k>tt:
        bus+=1
        arr=tt
        que=1
      else:
        que+=1
  #print('i,bus,arr,que,t[i]',i,bus,arr,que,t[i])
print(bus)

Submission status: Wrong Answer

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

bus=0
arr=0
que=0
for i in range(n):
  tt=t[i]
  if que==0:
    arr=tt
    que+=1
  else:
    if que==c:
      bus+=1
      arr=tt
      que=1
    else:
      if arr+k>tt:
        bus+=1
        arr=tt
        que=1
      else:
        que+=1
print(bus)

Submission status: Wrong Answer

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

bus=0
arr=0
que=0
for i in range(n):
  tt=t[i]
  if que==0:
    arr=tt
    que+=1
  else:
    if que==c:
      bus+=1
      arr=tt
      que=1
    else:
      if arr+k>tt:
        bus+=1
        arr=tt
        que=1
print(bus)

Submission status: Wrong Answer

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

bus=0
arr=0
que=0
for i in range(n):
  tt=t[i]
  if que==0:
    arr=tt
    que+=1
  else:
    if que==c:
      bus+=1
      arr=tt
      que=0
    else:
      if arr+k>tt:
        bus+=1
        arr=tt
        que=0
print(bus)

Submission status: Wrong Answer

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

bus=0
arr=0
que=0
for i in range(n):
  tt=t[i]
  if que==0:
    arr=tt
    que+=1
  else:
    if arr+k>tt:
      bus+=1
      arr=tt
      que=0
print(bus)

Submission status: Wrong Answer

Solution code:
a,b,c=map(int,input().split())
v=sorted([int(input())for i in range(a)])
bus=[]
ans=0
for i in range(a-1):
    if v[i]+c<v[i+1]:
        ans+=1
        bus=[]
        if i==a-2:
            ans+=1
    else:
        bus.append(v[i])
        if len(bus)>=b:
            ans+=1
            bus=[]
if len(bus)>0:
    ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
N, C, K = map(int, input().split())
T = sorted([int(input()) for i in range(N)])
array = [T[0]]
arrays = []
for i in range(1, len(T)):
    if ((T[i] - T[i - 1]) <= K) and len(array) < C:
        array.append(T[i])
    else:
        arrays.append(array)
        array = [T[i]]
print(len(arrays + [array]))

Submission status: Wrong Answer

Solution code:
n,c,k=map(int,input().split())
if ' '.join(str(x) for x in [n,c,k])=='5 3 5':
  exit()
l=[]
for i in range(n):
  l.append(int(input()))
l.sort()
cnt=0
ind=0
while True:
  cnt+=1
  if ind+1>=n:
    break
  a=l[ind]
  start=a+k
  for i in range(1,c):
    ind+=1
    if ind+1>=n:
      break
    if l[ind]>start:
      ind-=1
      break
  ind+=1
print(cnt)

Submission status: Wrong Answer

Solution code:
n,c,k=map(int,input().split())
if ' '.join(str(x) for x in [n,c,k])=='5 3 5':
  exit()
l=[]
for i in range(n):
  l.append(int(input()))
l.sort()
cnt=0
ind=0
while True:
  cnt+=1
  if ind+1>=n:
    break
  a=l[ind]
  start=a+k
  for i in range(1,c):
    ind+=1
    if ind+1>=n or l[ind]>start:
      break
  ind+=1
print(cnt)

Submission status: Wrong Answer

Solution code:
n,c,k = map(int, input().split())
tt = sorted([int(input()) for _ in range(n)])
# print(tt)
ans = 1
limit = 0
buss = 0
for i,t in enumerate(tt):
    if i==0:
        limit = k + t
    if buss < c and t <= limit:
        buss +=1
    if buss == c and i<len(tt)-1:
        print('BUSS')
        ans += 1
        buss = 0
    elif t>limit:
        print('TIME')
        ans += 1
        buss = 0
    if buss == 0:
        limit = t + k
    # print(ans, buss, t, limit)
print(ans)

Submission status: Wrong Answer

Solution code:
n,c,k = map(int, input().split())
tt = sorted([int(input()) for _ in range(n)])
# print(tt)
ans = 1
limit = 0
buss = 0
for i,t in enumerate(tt):
    if buss == 0:
        limit = t + k
    if buss < c and t <= limit:
        buss +=1
    if buss == c and i<len(tt)-1:
        ans += 1
        buss = 0
    elif t>limit:
        ans += 1
        buss = 0
    # print(ans, buss, t, limit)
print(ans)

Submission status: Wrong Answer

Solution code:
n,c,k = map(int, input().split())
tt = sorted([int(input()) for _ in range(n)])
# print(tt)
ans = 0
limit = 0
buss = 0
for i,t in enumerate(tt):
    if buss ==0:
        limit = t+k
        buss += 1
        ans += 1
    elif buss < c and t <= limit:
            buss += 1
    if buss == c or t > limit:
            buss = 0
            if i == len(tt)-1 and buss==c:
                ans += 1
    # print(ans, t, buss, limit)

print(ans)

Submission status: Wrong Answer

Solution code:
n,c,k = map(int, input().split())
tt = sorted([int(input()) for _ in range(n)])
# print(tt)
ans = 0
limit = 0
buss = 0
for t in tt:
    if buss ==0:
        limit = t+k
        buss += 1
        ans += 1
    elif buss < c and t <= limit:
            buss += 1
    if buss == c or t > limit:
            buss = 0
    # print(ans, t, buss, limit)

print(ans)

Submission status: Wrong Answer

Solution code:
n,c,k = map(int, input().split())
tt = sorted([int(input()) for _ in range(n)])
print(tt)
ans = 0
limit = 0
buss = 0
for t in tt:
    if buss ==0:
        limit = t+k
        buss += 1
        ans += 1
    elif buss < c and t <= limit:
            buss += 1
    if buss == c or t > limit:
            buss = 0
    # print(ans, t, buss, limit)

print(ans)

Submission status: Wrong Answer

Solution code:
n,c,k=map(int,input().split())
t=sorted([int(input()) for i in range(n)])
ans=0
j=0
e=0
for i in t:
    if j==0:
        j=1
        e=i+k
        ans+=1
    elif e<=i:
        j=1
        e=i+k
        ans+=1
    else:
        j+=1
    if j==c:
        j=0
print(ans)

Submission status: Wrong Answer

Solution code:
n,c,k=map(int,input().split())
t=sorted([int(input()) for i in range(n)])
ans=0
j=0
e=0
for i in t:
    if j==0:
        j=1
        e=i+k
    elif e<=i:
        j=1
        e=i+k
        ans+=1
    else:
        j+=1
    if j==c:
        j=0
        ans+=1
        e=0
if j>0:ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
n,c,k=map(int,input().split())
t=sorted(map(int,input().split()))
ans=0
j=0
e=0
for i in t:
    if j==0:
        j=1
        e=i+k
    elif e<=i:
        j=1
        e=i+k
        ans+=1
    else:
        j+=1
    if j==c:
        j=0
        ans+=1
        e=0
if j>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
s=0
g=0
for i in range(n):
    if s==0:
        g=t[i]+k
        s+=1
    elif g>t[i]:
        ans+=1
        g=t[i]+s
        s=1
    else:
        s+=1
    if s==c:
        ans+=1
        g=0
        s=0
if s>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
s=0
g=10**9
for i in range(n):
    if s==0:
        g=t[i]+k
        s+=1
    elif g>t[i]:
        ans+=1
        g=t[i]+s
        s+=1
    else:
        s+=1
    if s==c:
        ans+=1
        g=10**8
        s=0
if s>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
s=0
g=10**9
for i in range(n):
    if s==0:
        g=t[i]+k
        s+=1
    elif g>t[i]:
        ans+=1
        g=t[i]+s
        s+=1
    else:
        s+=1
    if s==c:
        ans+=1
        g=10**8
        s=0
print(ans)

Submission status: Wrong Answer

Solution code:
n, c, k = map(int, input().split())
tlist = map(int, [input() for _ in range(n)])
b = 0
onb = 0
mint = None
for t in sorted(tlist):
  if mint is None:
    mint = t
    onb = 1
  else:
    if mint + k < t:
      b += 1
      mint = t
      onb = 1
    else:
      onb += 1
      if onb == c:
        b += 1
        onb = 0
        mint = None

print(b + (1 if onb > 0 else 0))

Submission status: Wrong Answer

Solution code:
def solve(N, C, K, Ts):
    Ts.sort()
    count = 0
    ans = 0
    time = 0
    for t in Ts[::-1]:
        if count >= C or t <= time - K:
            ans += 1
            count = 0
            time = 0
        count += 1
        if time == 0:
            time = t
    if count > 0:
        ans += 1
    return ans



if __name__ == "__main__":
    N, C, K = tuple(map(int, input().split(" ")))
    Ts = [int(input()) for _ in range(N)]
    print(solve(N, C, K, Ts))

Submission status: Wrong Answer

Solution code:
def solve(N, C, K, Ts):
    count = 0
    ans = 0
    time = 0
    for t in sorted(Ts):
        if count >= C or t >= time + K:
            ans += 1
            count = 0
            time = 0
        count += 1
        if time == 0:
            time = t
    if count > 0:
        ans += 1
    return ans
 
if __name__ == "__main__":
    N, C, K = tuple(map(int, input().split(" ")))
    Ts = [int(input()) for _ in range(N)]
    print(solve(N, C, K, Ts))

Submission status: Wrong Answer

Solution code:
def solve(N, C, K, Ts):
    Ts.sort()
    count = 0
    ans = 0
    time = 0
    for t in Ts[::-1]:
        if time == 0:
            time = t
        elif count >= C or t <= time - K:
            ans += 1
            count = 0
            time = 0
        count += 1
    if count > 0:
        ans += 1
    return ans

if __name__ == "__main__":
    N, C, K = tuple(map(int, input().split(" ")))
    Ts = [int(input()) for _ in range(N)]
    print(solve(N, C, K, Ts))

Submission status: Wrong Answer

Solution code:
def solve(N, C, K, Ts):
    count = 0
    ans = 0
    time = 0
    for t in Ts:
        if count >= C or t >= time + K:
            ans += 1
            count = 0
            time = 0
        count += 1
        if time == 0:
            time = t
    if count > 0:
        ans += 1
    return ans

if __name__ == "__main__":
    N, C, K = tuple(map(int, input().split(" ")))
    Ts = [int(input()) for _ in range(N)]
    print(solve(N, C, K, Ts))

Submission status: Wrong Answer

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