結果

問題 No.33 アメーバがたくさん
ユーザー tonyu0tonyu0
提出日時 2019-12-24 23:26:17
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 1,032 bytes
コンパイル時間 765 ms
コンパイル使用メモリ 175,544 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-23 22:18:54
合計ジャッジ時間 1,559 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 0 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::Read;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let d: i64 = itr.next().unwrap().parse().unwrap();
    let t: i64 = itr.next().unwrap().parse().unwrap();
    let a: Vec<i64> = (0..n)
        .map(|_| itr.next().unwrap().parse().unwrap())
        .collect();

    let mut ans: i64 = 0;
    let mut check: Vec<bool> = vec![false; n];
    for i in 0..n {
        if !check[i] {
            check[i] = true;
            // 左側
            ans += t * 2 + 1;
            for j in i + 1..n {
                if (a[j] - a[j - 1]) % d == 0 {
                    check[j] = true;
                    if (a[j] - a[j - 1]) / d / 2 <= t {
                        ans += (a[j] - a[j - 1]) / d;
                    } else {
                        ans += t * 2 + 1;
                    }
                }
            }
        }
    }
    println!("{}", ans);
}
0