結果

問題 No.3684 chokudai_niku.png
コンテスト
ユーザー あるふぁ
提出日時 2026-09-06 10:30:22
言語 Rust
(1.97.1 + proconio + num + itertools + ACL)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 19 ms / 2,000 ms
+ 180µs
コード長 354 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 844 ms
コンパイル使用メモリ 181,720 KB
実行使用メモリ 8,944 KB
最終ジャッジ日時 2026-09-06 10:30:42
合計ジャッジ時間 6,964 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 44
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

use proconio::input;

fn main(){
    input!{
        n: usize,
        m: usize,
        a: [i64; n],
        b: [i64; n],
    }

    let mut s = vec![0_i64; n+1];
    for i in 0..n{
        s[i+1] = s[i]+(a[i]-b[i]).max(0_i64);
    }

    let mut ans = i64::MIN;
    for i in m..=n{
        ans = ans.max(s[i]-s[i-m]);
    }

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