結果

問題 No.3241 Make Multiplication of 8
ユーザー urectanc
提出日時 2025-08-22 21:21:32
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 12 ms / 2,000 ms
コード長 445 bytes
コンパイル時間 12,003 ms
コンパイル使用メモリ 399,972 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-08-22 21:21:47
合計ジャッジ時間 13,656 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

use proconio::input;

fn main() {
    input! {
        n: usize,
        cards: [(usize, usize); n],
    }

    let mut count = [0usize; 4];
    for &(a, b) in &cards {
        let i = a.trailing_zeros().min(3) as usize;
        count[i] += b;
    }

    let mut ans = count[3];

    let m = count[1].min(count[2]);
    count[1] -= m;
    count[2] -= m;
    ans += m;

    ans += count[1] / 3;
    ans += count[2] / 2;

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