結果

問題 No.2757 Pin Game
ユーザー Yukino DX.
提出日時 2024-05-17 21:31:06
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 309 bytes
コンパイル時間 13,170 ms
コンパイル使用メモリ 402,924 KB
実行使用メモリ 7,424 KB
最終ジャッジ日時 2024-12-20 13:15:33
合計ジャッジ時間 13,741 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

use proconio::input;

fn main() {
    input! {
        n:usize,
        k:i64,
        x:[i64;n],
    }

    let mut ans = 1;
    let mut lastx = x[0];
    for i in 1..n {
        if x[i] - lastx < k {
            continue;
        }

        lastx = x[i];
        ans += 1;
    }

    println!("{}", ans);
}
0