結果

問題 No.146 試験監督(1)
コンテスト
ユーザー norioc
提出日時 2026-04-02 23:45:04
言語 Rust
(1.94.0 + proconio + num + itertools)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
WA  
実行時間 -
コード長 750 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 827 ms
コンパイル使用メモリ 199,132 KB
実行使用メモリ 207,104 KB
最終ジャッジ日時 2026-04-02 23:45:35
合計ジャッジ時間 1,469 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 2 MLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#![allow(non_snake_case)]

#[allow(unused_imports)]
use proconio::{input, marker::Usize1, marker::Chars};
#[allow(unused_imports)]
use itertools::Itertools;

#[allow(unused_macros)]
macro_rules! d {
    ( $( $x:expr ),* $(,)? ) => {
        println!(
            concat!( $( stringify!($x), "={:?} " ),* ),
            $( $x ),*
        );
    };
}

fn divmod(a: i64, b: i64) -> (i64, i64) {
    (a.div_euclid(b), a.rem_euclid(b))
}

const MOD: i64 = 1_000_000_007;

fn main() {
    input! {
        N: usize,
        xs: [(i64, i64); N],
    }

    let ans = xs.iter()
        .fold(0, |acc, &(C, D)| {
            let (d, m) = divmod(C, 2);
            let x = (d + m) * D % MOD;
            (acc + x) % MOD
        });

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