Submission #18738790


Source Code Expand

use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {in_n: i64, in_m: usize, mut in_as: [i64; in_m]};
    let mut spaces = Vec::new();
    let mut kernel = in_n;
    let mut pos = 0;

    in_as.sort();

    for v in in_as.iter() {
        let a = v - 1;

        if a != pos {
            spaces.push(a - pos);
            kernel = kernel.min(a - pos);
        }

        pos = a + 1;
    }

    if pos != in_n {
        spaces.push(in_n - pos);
        kernel = kernel.min(in_n - pos);
    }

    eprintln!("{:?},k={}", spaces, kernel);

    if kernel == 1 {
        println!("{}", spaces.iter().fold(0, |a, &b| a + b));
    } else {
        println!(
            "{}",
            spaces.iter().fold(0, |a, &b| a + (b + kernel - 1) / kernel)
        );
    }
}

Submission Info

Submission Time
Task D - Stamp
User takedarts
Language Rust (1.42.0)
Score 400
Code Size 778 Byte
Status AC
Exec Time 535 ms
Memory 7752 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 4
AC × 30
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
All handmade_00.txt, handmade_01.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
Case Name Status Exec Time Memory
handmade_00.txt AC 7 ms 2120 KiB
handmade_01.txt AC 2 ms 2120 KiB
random_00.txt AC 2 ms 2132 KiB
random_01.txt AC 2 ms 2144 KiB
random_02.txt AC 339 ms 5284 KiB
random_03.txt AC 528 ms 7612 KiB
random_04.txt AC 3 ms 2152 KiB
random_05.txt AC 314 ms 5128 KiB
random_06.txt AC 532 ms 7752 KiB
random_07.txt AC 2 ms 2008 KiB
random_08.txt AC 2 ms 2000 KiB
random_09.txt AC 33 ms 5424 KiB
random_10.txt AC 2 ms 2124 KiB
random_11.txt AC 88 ms 4276 KiB
random_12.txt AC 2 ms 1984 KiB
random_13.txt AC 2 ms 2112 KiB
random_14.txt AC 421 ms 6232 KiB
random_15.txt AC 32 ms 4704 KiB
random_16.txt AC 2 ms 2136 KiB
random_17.txt AC 10 ms 2020 KiB
random_18.txt AC 535 ms 7460 KiB
random_19.txt AC 3 ms 2128 KiB
random_20.txt AC 1 ms 2112 KiB
random_21.txt AC 6 ms 2308 KiB
random_22.txt AC 2 ms 1992 KiB
random_23.txt AC 24 ms 2180 KiB
sample_01.txt AC 2 ms 2124 KiB
sample_02.txt AC 2 ms 2116 KiB
sample_03.txt AC 2 ms 2140 KiB
sample_04.txt AC 1 ms 2108 KiB