結果

問題 No.999 てん vs. ほむ
コンテスト
ユーザー taba
提出日時 2024-08-02 13:37:12
言語 Rust
(1.94.0 + proconio + num + itertools)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 154 ms / 2,000 ms
コード長 493 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,894 ms
コンパイル使用メモリ 189,636 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2026-04-03 19:27:23
合計ジャッジ時間 8,842 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge5_0
純コード判定待ち
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

fn main() {
    proconio::input! {
        n: usize,
        a: [i64; n*2],
    }
    let points = a.chunks_exact(2).map(|x| x[1] - x[0]).collect::<Vec<_>>();
    eprintln!("{points:?}");
    let mut lpoint = 0;
    let mut rpoint = points.iter().sum::<i64>();
    let mut point_max = lpoint + rpoint;
    for i in 0..points.len() {
        lpoint -= points[i];
        rpoint -= points[i];
        point_max = std::cmp::max(point_max, lpoint + rpoint);
    }
    println!("{}", point_max);
}
0