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 = sorted(T)
count = 0
num = 1
h = T_sort[0]+k
for t in T:
  count += 1
  if t <= h and count <= c:
    continue
  elif t > h:
    num += 1
    count = 0
    h = t+k
  elif t <= h and count > c:
    num += 1
    count = 0
    h = t+k
print(num)

Submission status: Wrong Answer

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

T.sort()
i = 0
ans = 0

while i < N:
    t = T[i]
    x = T.count(T[i])
    ans = ans + (x-1+C)//C
    for j in range(i+((x-1+C)//C)*C-1,N):
        if T[j]>t+K:
            y = j-i
            break
        y = N-i
            
    y=min(C,y)
    i = i + y 

print(ans)

Submission status: Wrong Answer

Solution code:
N, C, K = map(int, input().split())
T = [0] * N
for i in range(N):
    T[i] = int(input())
T.sort()
t = T[0]
ans = 1
c = 0
for i in range(N):
    if c == C:
        c = 0
        ans += 1
        t = T[i]
    elif T[i] > t + K:
        ans += 1
        c = 1
        t = T[i]
    else:
        c += 1

print(ans)

Submission status: Wrong Answer

Solution code:
N, C, K = map(int, input().split())
T = [0] * N
for i in range(N):
    T[i] = int(input())
T.sort()
t = T[0]
ans = 1
c = 0
for i in range(N):
    if c == C:
        c = 0
        ans += 1
        t = T[i]
    elif T[i] > t + K:
        ans += 1
        c = 0
        t = T[i]
    else:
        c += 1

print(ans)

Submission status: Wrong Answer

Solution code:
N, C, K = map(int, input().split())
T = [0] * N
for i in range(N):
    T[i] = int(input())
T.sort()
t = T[0] + K
cnt = 0
c = 1
for i in range(N-1):
    if T[i] > t:
        t = T[i+1] + K
        cnt += 1
        c = 1
    elif c == C:
        c = 1
        cnt += 1
        t = T[i+1] + K
    else:
        c += 1
c += 1
if T[-1] <= t and c <= C:
    cnt += 1
else:
    cnt += 2

print(cnt)

Submission status: Wrong Answer

Solution code:
N, C, K = map(int, input().split())
T = [0] * N
for i in range(N):
    T[i] = int(input())
T.sort()
t = T[0] + K
cnt = 0
c = 1
for i in range(N-1):
    if T[i] > t:
        t = T[i+1] + K
        cnt += 1
        c = 1
    if c == C:
        c = 1
        cnt += 1
        t = T[i+1] + K
    else:
        c += 1
c += 1
if T[-1] <= t and c <= C:
    cnt += 1
else:
    cnt += 2

print(cnt)

Submission status: Wrong Answer

Solution code:
N, C, K = map(int, input().split())
T = [0] * N
for i in range(N):
    T[i] = int(input())
T.sort()
t = T[0] + K
cnt = 1
c = 0
for i in range(N-1):
    if T[i] > t or C == c:
        t = T[i+1] + K
        cnt += 1
        c = 0
    else:
        c += 1
c += 1
if T[-1] <= t and c <= C:
    pass
else:
    cnt += 1

print(cnt)

Submission status: Wrong Answer

Solution code:
from copy import *
from sys import *
import math
import queue
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac

setrecursionlimit(1000000)

#s[i] is linked with t[len(s)-i-1]
def main():
	n,c,k = map(int,input().split())
	t = [int(input()) for i in range(n)]
	t.sort()
	ans=1
	count=1
	first=t[0]
	for i in t[1:]:
		if(count>c or first + k <= i):
			ans+=1
			count=1
			first=i
		else:
			count+=1
	print(ans)

def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def is_prime(n):
	if n < 2: return False

	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False

	return True

def list_replace(n,f,t):
	return [t if i==f else i for i in n]

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(m,n):
	x = max(m,n)
	y = min(m,n)
	while(x%y!=0):
		z = x%y
		x = y
		y = z
	return y

class Queue():
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class Stack():
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class graph():
	def __init__(self):
		self.graph = defaultdict(list)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
		self.graph[t].append(f)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
		self.graph[t].remove(f)
	def linked(self,f):
		return self.graph[f]

class dgraph():
	def __init__(self):
		self.graph = defaultdict(set)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
	def linked(self,f):
		return self.graph[f]

main()

Submission status: Wrong Answer

Solution code:
from copy import *
from sys import *
import math
import queue
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac

setrecursionlimit(1000000)

#s[i] is linked with t[len(s)-i-1]
def main():
	n,c,k = map(int,input().split())
	t = [int(input()) for i in range(n)]
	t.sort()
	print(t)
	ans=1
	count=1
	first=t[0]
	for i in t[1:]:
		if(count>c or first + k <= i):
			ans+=1
			count=1
			first=i
		else:
			count+=1
	print(ans)

def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def is_prime(n):
	if n < 2: return False

	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False

	return True

def list_replace(n,f,t):
	return [t if i==f else i for i in n]

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(m,n):
	x = max(m,n)
	y = min(m,n)
	while(x%y!=0):
		z = x%y
		x = y
		y = z
	return y

class Queue():
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class Stack():
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class graph():
	def __init__(self):
		self.graph = defaultdict(list)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
		self.graph[t].append(f)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
		self.graph[t].remove(f)
	def linked(self,f):
		return self.graph[f]

class dgraph():
	def __init__(self):
		self.graph = defaultdict(set)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
	def linked(self,f):
		return self.graph[f]

main()

Submission status: Wrong Answer

Solution code:
def main():
    N, C, K = map(int, input().split())
    T = [int(input()) for _ in range(N)]
    T.sort()
    ans = 0
    remain = 0
    first = 0
    for t in T:
        if remain <= 0 or first + C < t:
            remain = K
            first = t
            ans += 1
        remain -= 1
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
from collections import deque
n,c,k=map(int,input().split())
l=sorted([int(input()) for _ in range(n)],reverse=True)
ans=0
d=deque(l)
while len(d)!=0:
    ans+=1
    t=d.popleft()
    for i in range(k-1):
        if len(d)!=0 and d[0]>=t-c:
            d.popleft()
print(ans)

Submission status: Wrong Answer

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

t_sorted = sorted(t_list)

ans = 1
bus = 0
timer = 0
for i in range(1, len(t_sorted)):
    bus += 1
    timer += t_sorted[i] - t_sorted[i - 1]
    if bus >= c or timer >= k:
        ans += 1
        bus = 1
        timer = 0

print(ans)

Submission status: Wrong Answer

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

t_sorted = sorted(t_list)

ans = 1
bus = 0
timer = 0
for i in range(1, len(t_sorted)):
    bus += 1
    timer += t_sorted[i] - t_sorted[i - 1]
    if bus >= c or timer >= k:
        ans += 1
        bus = 0
        timer = 0

print(ans)

Submission status: Wrong Answer

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

t_sorted = sorted(t_list)

ans = 1
bus = 0
timer = 0
for i in range(1, len(t_sorted)):
    if t_sorted[i] - t_sorted[i - 1] > k:
        ans += 1
    elif t_sorted[i] - t_sorted[i - 1] <= k:
        bus += 1
        timer += t_sorted[i] - t_sorted[i - 1]
        if bus >= c or timer >= k:
            ans += 1
            bus = 0
            timer = 0

print(ans)

Submission status: Wrong Answer

Solution code:

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

ans = 1
passed = 0
nums = [ int(input()) for _ in range(N)]
nums.sort()
before = nums[0]
c = 1

for t in nums[1:]:

    c += 1
    passed += t - before
    if passed > K or c > C: #次のバス
        c = 0
        passed = 0
        ans += 1
    before = t
print(ans)

Submission status: Wrong Answer

Solution code:

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

ans = 1
c = 0
before = 0
passed = 0
nums = [ int(input()) for _ in range(N)]
nums.sort()
for t in nums:
    passed += t -before
    c += 1
    if passed > K or c > C: #次のバス
        c = 0
        passed = 0
        ans += 1

    before = t
print(ans)

Submission status: Wrong Answer

Solution code:

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

ans = 1
c = 0
before = 0
passed = 0
nums = [ int(input()) for _ in range(N)]
nums.sort()
for t in nums:
    passed += t -before
    if passed > K or c > C: #次のバス
        c = 0
        passed = 0
        ans += 1
    c += 1
    before = t
print(ans)

Submission status: Wrong Answer

Solution code:

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

ans = 1
c = 0
before = 0
passed = 0
nums = [ int(input()) for _ in range(N)]
for t in nums:
    passed += t -before
    if passed > K or c > C: #次のバス
        c = 0
        passed = 0
        ans += 1
    c += 1
    before = t
print(ans)

Submission status: Wrong Answer

Solution code:
N, C, K = map(int, input().split()) # 横に2個
T = [int(input()) for _ in range(N)]

T.sort()

first = True
ans = 0
for t in T:
    if first:
        limit = t + K
        peo = 1
        first = False
    elif t <= limit:
        peo += 1
    if peo == C or t > limit:
        ans += 1
        first = True

if peo > 0:
    ans += 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()
ans=0
p=0
for i in range(n):
    if p==0:
        p=t[i]
        ans+=1
    elif t[i]>p+c:
        p=t[i]
        ans+=1
print(ans)

Submission status: Wrong Answer

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

ans=0
c=0
t=0

for i in range(N):
    c+=1

    if c==1:
        t=T[i]

    if c==C or T[i+1]>t+K:
        ans+=1
        c=0

print(ans)

Submission status: Wrong Answer

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

ans=0
c=0
t=0

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

    if c==0:
        t=T[i]

    c+=1

if c>=2:
    print(ans+1)
else:
    print(ans)

Submission status: Wrong Answer

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

ans=0
c=0
t=0

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

    if c==0:
        t=T[i]

    c+=1

print(ans+1)

Submission status: Wrong Answer

Solution code:
from sys import stdin
N,C,K = [int(x) for x in stdin.readline().rstrip().split()]
 
data = []
for _ in range(N):
    data.append(int(input()))
data = sorted(data)
ans = 0
time = 0
buss = 0
for ind,i in enumerate(data):
    if buss == 0:
        time = i
    if time + K >= i:
        buss += 1
        if ind == N - 1:
          ans += 1
    else:
        buss = 1
        tmp = time
        time = i
        ans += 1
        if ind == N - 1 and time - tmp > K:
            ans += 1
        
    if buss == C:
        time = i
        ans += 1
        buss = 0
    #print(time,buss,ans)
print(ans)

Submission status: Wrong Answer

Solution code:
from sys import stdin
N,C,K = [int(x) for x in stdin.readline().rstrip().split()]
 
data = []
for _ in range(N):
    data.append(int(input()))
data = sorted(data)
ans = 0
time = 0
bus = 0

for ind,i in enumerate(data):
    if bus == 0:
        time = i
    
    if i <= time + K:
        bus += 1
    
    else:
        ans += 1
        bus = 1
        time = i
    
    if bus == C:
        ans += 1
        bus = 0
        
    if ind == N - 1 and i != 0:
        ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
from sys import stdin
N,C,K = [int(x) for x in stdin.readline().rstrip().split()]
 
data = []
for _ in range(N):
    data.append(int(input()))
data = sorted(data)
ans = 0
time = 0
buss = 0
 
for i in data:
    if buss == 0:
        time = i
    if time + K >= i:
        buss += 1
        if i == data[-1] and time != i:
          ans += 1
    else:
        buss = 1
        tmp = time
        time = i
        ans += 1
        if i == data[-1] and time - tmp > K:
            ans += 1
        
    if buss == C:
        if i == data[-1] and i != time:
          ans -= 1
        time = i
        ans += 1
        buss = 0
    #print(time,buss,ans)
print(ans)

Submission status: Wrong Answer

Solution code:
from sys import stdin
N,C,K = [int(x) for x in stdin.readline().rstrip().split()]
 
data = []
for _ in range(N):
    data.append(int(input()))
data = sorted(data)
ans = 0
time = 0
buss = 0
 
for i in data:
    if buss == 0:
        time = i
    if time + K >= i:
        buss += 1
        if i == data[-1]:
          ans += 1
    else:
        buss = 1
        tmp = time
        time = i
        ans += 1
        if i == data[-1] and time - tmp > K:
            ans += 1
        
    if buss == C:
        if i == data[-1]:
          ans -= 1
        time = i
        ans += 1
        buss = 0
    #print(time,buss,ans)
print(ans)

Submission status: Wrong Answer

Solution code:
from sys import stdin
N,C,K = [int(x) for x in stdin.readline().rstrip().split()]
 
data = []
for _ in range(N):
    data.append(int(input()))
data = sorted(data)
ans = 0
time = 0
buss = 0
 
for i in data:
    if buss == 0:
        time = i
    if time + K >= i:
        buss += 1
        if i == data[-1]:
          ans += 1
    else:
        buss = 1
        tmp = time
        time = i
        ans += 1
        if i == data[-1] and time - tmp > K:
            ans += 1
        
    if buss == C:
        time = i
        ans += 1
        buss = 0
    #print(time,buss,ans)
print(ans)

Submission status: Wrong Answer

Solution code:
from sys import stdin
N,C,K = [int(x) for x in stdin.readline().rstrip().split()]

data = []
for _ in range(N):
    data.append(int(input()))
data = sorted(data)
ans = 0
time = 0
buss = 0

for i in data:
    if buss == 0:
        time = i
    if time + C > i:
        buss += 1
        if i == data[-1]:
          ans += 1
    else:
        buss = 1
        tmp = time
        time = i
        ans += 1
        if i == data[-1] and time - tmp > K:
            ans += 1
        
    if buss == C:
        time = i
        ans += 1
        buss = 0
    #print(time,buss,ans)
print(ans)

Submission status: Wrong Answer

Solution code:
n,c,k=map(int,input().split())
t=int(input())
ans=0
for i in range(n-1):
  tt=int(input())
  if t+k<tt:ans+=1;t=tt
print(ans+1)

Submission status: Wrong Answer

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

T.sort()

bus=-10**9
cnt=0
ans=0
for t in T:
    if t>bus or cnt>C:
        bus=t+K
        cnt=1
        ans+=1
    else:
        cnt+=1

print(ans)

Submission status: Wrong Answer

Solution code:
n, c, k = map(int, input().split())
l = [int(input()) for i in range(n)]
count = 0
first = l[0]
people = 1
count = 1
for i in range(1, n):
    if people < c and l[i] - first <= k:
        people += 1
    else:
        first = l[i]
        people = 1
        count += 1
print(count)

Submission status: Wrong Answer

Solution code:
passengers, bus_size, time_lim = map(int, input().split())
pass_list = [int(input()) for passenger in range(passengers)]
pass_list.sort()
front = 0
now = 0
cnt = 0
ans = 0
for psngr_lst in pass_list:
    if cnt == 0:
        front = psngr_lst
        now = psngr_lst
        cnt += 1
    elif cnt == bus_size:
        front = psngr_lst
        now = psngr_lst
        cnt = 1
        ans += 1
    elif now - front <= time_lim:
        if psngr_lst - front <= time_lim:
            now = psngr_lst
            cnt += psngr_lst
        else:
            front = psngr_lst
            now = psngr_lst
            cnt = 1
            ans += 1
if cnt:
    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)]
sort_T = sorted(T)
a = 0 #バスの乗車人数
cnt = 0 #バスの台数
t = 0 #バスの一人目の到着時刻+K

for i in range(N):
    if a == 0:
        t = sort_T[i] + K
        a += 1
        cnt += 1
        continue
    if sort_T[i] < t and a < C:
        a += 1
    else:
        a = 1
        t = sort_T[i] + K
        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()
bs=0
ans=0
for i in range(n):
  if(bs==0):
    ans+=1
    bs=t[i]
    p=1
  else:
    if(p==c):
      bs=t[i]
      ans+=1
      p=1
    elif(bs+c<t[i]):
      bs=t[i]
      ans+=1
      p=1
    else:
      p+=1
print(ans)

Submission status: Wrong Answer

Solution code:
n, c, k = list(map(int, input().split()))
t = sorted([int(input()) for i in range(n)], reverse=True)
result = 1
total = 1
tmp = t[0]
for i in range(1, n):
  if total + 1 >= c or tmp-t[i] >= k:
    tmp = t[i]
    result += 1
    total = 1
  else:
    total += 1
print(result)

Submission status: Wrong Answer

Solution code:
n, c, k = list(map(int, input().split()))
t = sorted([int(input()) for i in range(n)], reverse=True)
result = 1
total = 1
tmp = t[0]
for i in range(1, n):
  if total + 1 >= c or tmp-t[i] >= k:
    tmp = t[i]
    result += 1
    total = 0
  else:
    total += 1
print(result)

Submission status: Wrong Answer

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

ans=0
nexttime=0
people=0
for t in T:
  if t>nexttime:
    nexttime=t+K
    ans+=1
    people=0
  people+=1
  if people==C:
    nexttime=0

Submission status: Wrong Answer

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

ans=0
nexttime=0
people=0
for t in T:
  if t>nexttime:
    nexttime=t+K
    ans+=1
  people+=1
  if people==C:
    nexttime=0
    
  
print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
A - Airport Bus
https://atcoder.jp/contests/agc011/tasks/agc011_a

"""
import sys


from bisect import bisect_right

def solve(N, C, K, T):
    ans, i = 0, 0
    while i < N:
        j = max(min(bisect_right(T, T[i+1]+K), i+C-1), i+1)
        ans += 1
        i = j
        if i + 1 == N:
            return ans + 1
    return ans


def main(args):
    N, C, K = map(int, input().split())
    T = sorted([int(input()) for _ in range(N)])
    ans = solve(N, C, K, T)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
A - Airport Bus
https://atcoder.jp/contests/agc011/tasks/agc011_a

"""
import sys


from bisect import bisect_right

def solve(N, C, K, T):
    ans, i = 0, 0
    while i < N:
        j = min(bisect_right(T, T[i+1]+K), i+C-1)
        ans += 1
        i = j
        if i + 1 == N:
            return ans + 1
    return ans


def main(args):
    N, C, K = map(int, input().split())
    T = sorted([int(input()) for _ in range(N)])
    ans = solve(N, C, K, T)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Wrong Answer

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

s = 1
p = 1
w = a[0]+k 
for t in a[1:]:
  if p == c or t > w:
    p = 0
    s += 1
    w = t+k
  else:
    p += 1
print(s)

Submission status: Wrong Answer

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

s = 0
p = 0
w = 0 
for t in a:
  if p == 0 or t > w:
    p = (p+1)%c
    s += 1
    w = t+k
  else:
    p = (p+1)%c
print(s)

Submission status: Wrong Answer

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

s = 0
p = 0
w = 0 
for t in a:
  if p == 0 or t > w:
    p += 1
    s += 1
    w = t+k
  else:
    p = (p+1)%c
print(s)

Submission status: Wrong Answer

Solution code:
n,c,k=map(int,input().split())
t=sorted([int(input()) for i in range(n)])
print(t)
a,x,y=1,1,t[0]
for i in t[1:]:
    if x==c or i>y+k:
        a+=1
        x=0
        y=i
    x+=1
print(a)

Submission status: Wrong Answer

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

t.sort()
bus = (len(t)+c-1) // c 
cnt = 0

for i in range(n-1):
    cnt += 1
    if cnt == c:
        cnt = 1
        continue
    if t[i]+k < t[i+1]:
        bus+= 1
        
print(bus)

Submission status: Wrong Answer

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

t.sort()
bus = (len(t)+c-1) // c 
cnt = 0

for i in range(n-1):
    if t[i]+k < t[i+1]:
        bus+= 1

print(bus)

Submission status: Wrong Answer

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

t.sort()
bus = 0
cnt = 0

for i in range(n-1):
    cnt += 1
    if t[i] + k < t[i+1]:
        cnt = 0
        bus += 1
        continue
    if cnt == c:
        cnt = 0
        bus += 1
        continue

print(bus+1)

Submission status: Wrong Answer

Solution code:
N,C,K=map(int,input().split())
T=[int(input()) for _ in range(N)]
flag=0
bus_cnt=0
First=T[0]
bus_rider=1
bus_cnt=1
for i in range(N):
    if bus_rider<C and T[i]-First<=K:
        bus_rider+=1
    else:
        First=T[i]
        bus_rider=1
        bus_cnt+=1
print(bus_cnt)

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    [N, C, K] = [int(i) for i in input().split()]

    T = []
    for i in range(N):
        T.append(int(input()))
    T.sort()

    counter = 1

    num_people = 0

    flag = False

    for num in T:
        num_people += 1
        if flag:
            if num - first_time <= K and num_people <= C:
                continue
            else:
                counter += 1
                num_people = 1
                flag = False
        else:
            first_time = num
            flag = True


    print(counter)

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    [N, C, K] = [int(i) for i in input().split()]

    T = []
    for i in range(N):
        T.append(int(input()))
    T.sort()

    counter = 1

    num_people = 0

    flag = False

    for num in T:
        print(num)
        print(flag)
        num_people += 1
        if flag:
            if num - first_time <= K and num_people <= C:
                continue
            else:
                counter += 1
                num_people = 1
                flag = False
                print('inc')
        else:
            first_time = num
            flag = True


    print(counter)

Submission status: Wrong Answer

Solution code:
N,C,K = [int(s) for s in input().split()]
T = []
for i in range(N):
    T.append(int(input()))
T.sort()
 
pas = 0
leave = T[0]
ans = 1
 
for t in T:
    if pas == C or K < t - leave:
        leave = t
        ans += 1
        pas = 0
    else:
        pas += 1
print(ans)

Submission status: Wrong Answer

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

pas = 0
leave = T[0]
ans = 1

for t in T:
    if pas == C or K < t - leave:
        leave = t
        ans += 1
        pas = 0
    else:
        pas += 1
print(ans)

Submission status: Wrong Answer

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

pas = 0
leave = T[0]
ans = 1

for t in T:
    if pas == C and K < t - leave:
        pas += 1
    else:
        leave = t
        ans += 1
        pas = 0
print(ans)

Submission status: Wrong Answer

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

pas = 0
leave = T[0]
ans = 1

for t in T:
    if pas != C and K >= t - leave:
        pas += 1
    else:
        leave = t
        ans += 1
        pas = 0
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()
person = 0
firsttime = 0
ans = 0
for i in range(n):
  if person == 0:
    firsttime = t[i]
    person += 1
  elif person <= c-1 and (firsttime + k) <= t[i]:
    person += 1
  else:
    person = 1
    firsttime = t[i]
    ans += 1
    
if person != 0:
  ans += 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()
person = 0
firsttime = 0
ans = 0
for i in range(n):
  if person == 0:
    firsttime = t[i]
    person += 1
  elif person <= c-1 and (firsttime + k) <= t[i]:
    person += 1
  else:
    person = 0
    ans += 1
    
if person != 0:
  ans += 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()
person = 0
firsttime = 0
ans = 0
for i in range(n):
  if person == 0:
    firsttime = t[i]
    person += 1
  elif person <= c and (firsttime + k) <= t[i]:
    person += 1
  else:
    person = 0
    ans += 1
    
if person != 0:
  ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
n,c,k = map(int,input().split())
T =[int(input()) for t in range(n)]
T.sort()
ans = 1
time = k
cur = 1
for i in range(1,n):
    if T[i]-T[i-1] <= time:
        cur +=1
        if cur > c:
            ans += 1
            cur = 1
        else:
            time -= (T[i]-T[i-1])
    else:
        ans += 1
        cur = 1
print(ans)

Submission status: Wrong Answer

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

i = 0
n_b = 0
n_passenger_on_waiting_bus = 0
departure_limit=-1

for i in range(N):
  if T[i] > departure_limit or n_passenger_on_waiting_bus == C:
    n_b +=1
    n_passenger_on_waiting_bus = 1
    departure_limit = T[i] + K
  else:
    n_passenger_on_waiting_bus += 1
    
print(n_b)

Submission status: Wrong Answer

Solution code:
n,c,k,*t=map(int,open(0).read().split())
t.sort()
#print(t)
time=0
bus=0
totalbus=1
for i in range(n):
    #print(time,time+k,t[i],bus,totalbus)
    if bus==0:
        time=t[i]
        bus=1
    else:
        if time<=t[i]<=time+k:
            bus+=1
            if bus==c:
                totalbus+=1
                bus=0
                try:
                    time=t[i+1]
                except:
                    break
        else:
            totalbus+=1
            bus=0
            try:
                time=t[i+1]
            except:
                break
print(totalbus)

Submission status: Wrong Answer

Solution code:
n,c,k,*t=map(int,open(0).read().split())
t.sort()
time=t[0]
bus=1  #cになったら発車
totalbus=1
for i in range(1,n):
    #print(t[i],bus,totalbus,time)
    if time<=t[i]<=time+k:
        bus+=1
        if bus==c:
            totalbus+=1
            bus=0
            try:
                time=t[i+1]
            except:
                break
        if i==n-1 and bus>0:
            totalbus+=1
    else:
        totalbus+=1
        bus=0
        try:
            time=t[i+1]
        except:
            break
print(totalbus)

Submission status: Wrong Answer

Solution code:
n,c,k,*t=map(int,open(0).read().split())
t.sort()
time=t[0]
bus=1  #cになったら発車
totalbus=1
for i in range(1,n):
    #print(t[i],bus,totalbus,time)
    if time<=t[i]<=time+k:
        bus+=1
        if bus==c:
            totalbus+=1
            bus=0
            try:
                time=t[i+1]
            except:
                break
    else:
        totalbus+=1
        bus=0
        try:
            time=t[i+1]
        except:
            break
print(totalbus)

Submission status: Wrong Answer

Solution code:
n, c, k = map(int, input().split())
T = sorted([int(input()) for _ in range(n)])
bus = 0
cus = 0
lmt = T[0] + k
for t in T:
    if cus == 0 or t > lmt:
        bus += 1
        cus += 1
        lmt = t + k
    else:
        cus +=1
    
    if cus == c:
        cus = 0
print(bus)

Submission status: Wrong Answer

Solution code:
n, c, k = map(int, input().split())
T = sorted([int(input()) for _ in range(n)])
bus = 0
cus = 0
lmt = T[0] + k
for t in T:
    if cus == 0 or t > lmt:
        bus += 1
        cus += 1
        lmt = t + k
    else:
        cus +=1
    
    if cus == 3:
        cus = 0
print(bus)

Submission status: Wrong Answer

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

bus = 1
key = T[0]
pas = 0
for i in range(N):
    if T[i] - key > K:
        bus += 1
        key = T[i]
        pas = 0
    else:
        pas += 1
        if pas == C:
            if i < N-1:
                bus += 1
                key = T[i+1]
                pas = 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()
in_bus = 0
ans = 1
limit = T[0]
for i in range(1,N):
    if T[i]-limit > K or in_bus == C:
        ans += 1
        limit = T[i]
    else:
        in_bus += 1
print(ans)