Submission #2380549


Source Code Expand

#!/usr/bin/env python3

import sys, math, copy
# import fractions, itertools
# import numpy as np
# import scipy

HUGE = 2147483647
HUGEL = 9223372036854775807
ABC = "abcdefghijklmnopqrstuvwxyz"

def main():
    n, c, k = map(int, input().split())
    ti = []
    for i in range(n):
        t = int(input())
        ti.append(t)
    ti = sorted(ti)
    next_time = -HUGE
    next_capacity = 0
    count_bus = 0
    for t in ti:
        if (next_capacity) == 0 or (next_time < t) or (next_time > t + k):
            next_time = t + k
            next_capacity = c - 1
            count_bus += 1
        else:
            next_capacity -= 1
    print(count_bus)

main()

Submission Info

Submission Time
Task A - Airport Bus
User sen_7
Language Python (3.4.3)
Score 300
Code Size 668 Byte
Status AC
Exec Time 230 ms
Memory 8792 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 12
Set Name Test Cases
Sample sample1.txt, sample2.txt
All sample1.txt, sample2.txt, in1.txt, in2.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, sample1.txt, sample2.txt
Case Name Status Exec Time Memory
in1.txt AC 24 ms 3444 KB
in2.txt AC 222 ms 8792 KB
in3.txt AC 218 ms 8788 KB
in4.txt AC 220 ms 8788 KB
in5.txt AC 25 ms 3572 KB
in6.txt AC 216 ms 8660 KB
in7.txt AC 202 ms 8040 KB
in8.txt AC 230 ms 8792 KB
sample1.txt AC 22 ms 3444 KB
sample2.txt AC 22 ms 3444 KB