Submission #16083873


Source Code Expand

Copy
use proconio::input;

fn main() {
    input! {
        n: usize,
        c: usize,
        k: usize,
        mut t: [usize; n],
    };
    t.sort();

    let mut ans = 0;
    let mut i_l = 0;
    let mut i_r = 0;
    while i_l < n {
        while i_r + 1 < n && t[i_r + 1] <= t[i_l] + k {
            i_r += 1;
        }
        ans += 1;
        i_l += c;
        if i_l > i_r {
            i_l = i_r + 1;
        }
    }
    println!("{}", ans);
}

Submission Info

Submission Time
Task A - Airport Bus
User bouzuya
Language Rust (1.42.0)
Score 300
Code Size 450 Byte
Status AC
Exec Time 29 ms
Memory 4176 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 6 ms 1948 KB
in2.txt AC 29 ms 4152 KB
in3.txt AC 28 ms 4176 KB
in4.txt AC 24 ms 4000 KB
in5.txt AC 2 ms 2032 KB
in6.txt AC 26 ms 4036 KB
in7.txt AC 26 ms 3684 KB
in8.txt AC 19 ms 4100 KB
sample1.txt AC 2 ms 2076 KB
sample2.txt AC 1 ms 2040 KB