結果

問題 No.1233 割り切れない気持ち
ユーザー phsplsphspls
提出日時 2022-12-17 16:59:28
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 810 bytes
コンパイル時間 15,540 ms
コンパイル使用メモリ 374,804 KB
実行使用メモリ 8,192 KB
最終ジャッジ日時 2024-04-28 10:54:37
合計ジャッジ時間 16,352 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
5,248 KB
testcase_01 AC 12 ms
5,376 KB
testcase_02 AC 13 ms
5,376 KB
testcase_03 AC 13 ms
5,376 KB
testcase_04 AC 12 ms
5,376 KB
testcase_05 AC 12 ms
5,376 KB
testcase_06 AC 13 ms
5,376 KB
testcase_07 AC 14 ms
5,888 KB
testcase_08 AC 16 ms
6,400 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 15 ms
5,760 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 17 ms
7,040 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 17 ms
7,040 KB
testcase_21 AC 19 ms
7,424 KB
testcase_22 AC 19 ms
7,424 KB
testcase_23 AC 19 ms
7,424 KB
testcase_24 AC 20 ms
7,552 KB
testcase_25 AC 20 ms
7,296 KB
testcase_26 AC 20 ms
7,424 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 13 ms
5,376 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

const LIMIT: usize = 200000;

fn main() {
    let mut n = String::new();
    std::io::stdin().read_line(&mut n).ok();
    let n: usize = n.trim().parse().unwrap();
    let mut a = String::new();
    std::io::stdin().read_line(&mut a).ok();
    let a: Vec<usize> = a.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();

    let mut acnts = vec![0usize; LIMIT+1];
    for &v in a.iter() { acnts[v] += 1; }
    for i in (0..LIMIT).rev() {
        acnts[i] += acnts[i+1];
    }
    let mut divides = vec![0usize; LIMIT+1];
    for i in 1..=LIMIT {
        for j in 1..=LIMIT/i {
            divides[i] += i*(j-1)*(acnts[i*(j-1)] - acnts[i*j]);
        }
    }
    let mut result = a.iter().sum::<usize>() * n;
    for &v in a.iter() {
        result -= divides[v];
    }
    println!("{}", result);
}
0