結果

問題 No.1013 〇マス進む
ユーザー phsplsphspls
提出日時 2023-01-20 23:27:54
言語 Rust
(1.77.0)
結果
AC  
実行時間 235 ms / 2,000 ms
コード長 982 bytes
コンパイル時間 5,001 ms
コンパイル使用メモリ 142,456 KB
実行使用メモリ 29,136 KB
最終ジャッジ日時 2023-09-05 15:56:19
合計ジャッジ時間 16,866 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,500 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 8 ms
4,380 KB
testcase_14 AC 86 ms
14,960 KB
testcase_15 AC 145 ms
23,060 KB
testcase_16 AC 135 ms
21,168 KB
testcase_17 AC 75 ms
13,312 KB
testcase_18 AC 96 ms
15,940 KB
testcase_19 AC 55 ms
10,300 KB
testcase_20 AC 178 ms
27,784 KB
testcase_21 AC 70 ms
12,380 KB
testcase_22 AC 101 ms
16,548 KB
testcase_23 AC 31 ms
6,740 KB
testcase_24 AC 184 ms
28,604 KB
testcase_25 AC 179 ms
28,076 KB
testcase_26 AC 33 ms
6,736 KB
testcase_27 AC 65 ms
11,844 KB
testcase_28 AC 32 ms
6,736 KB
testcase_29 AC 171 ms
27,272 KB
testcase_30 AC 61 ms
10,808 KB
testcase_31 AC 116 ms
18,920 KB
testcase_32 AC 81 ms
14,468 KB
testcase_33 AC 88 ms
14,352 KB
testcase_34 AC 150 ms
21,720 KB
testcase_35 AC 148 ms
20,744 KB
testcase_36 AC 11 ms
4,376 KB
testcase_37 AC 10 ms
4,380 KB
testcase_38 AC 162 ms
23,892 KB
testcase_39 AC 54 ms
8,984 KB
testcase_40 AC 162 ms
21,784 KB
testcase_41 AC 38 ms
6,932 KB
testcase_42 AC 91 ms
13,884 KB
testcase_43 AC 57 ms
9,740 KB
testcase_44 AC 95 ms
14,720 KB
testcase_45 AC 83 ms
13,144 KB
testcase_46 AC 41 ms
7,172 KB
testcase_47 AC 88 ms
13,872 KB
testcase_48 AC 102 ms
16,024 KB
testcase_49 AC 166 ms
21,792 KB
testcase_50 AC 124 ms
18,896 KB
testcase_51 AC 112 ms
17,076 KB
testcase_52 AC 23 ms
4,956 KB
testcase_53 AC 32 ms
6,280 KB
testcase_54 AC 136 ms
20,684 KB
testcase_55 AC 44 ms
7,492 KB
testcase_56 AC 191 ms
25,736 KB
testcase_57 AC 132 ms
18,040 KB
testcase_58 AC 235 ms
29,136 KB
testcase_59 AC 222 ms
29,100 KB
testcase_60 AC 205 ms
29,100 KB
testcase_61 AC 180 ms
29,124 KB
testcase_62 AC 176 ms
29,072 KB
testcase_63 AC 1 ms
4,376 KB
testcase_64 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

    let mut addval = vec![vec![0usize; n]; 32];
    for i in 0..n {
        addval[0][i] = p[i];
    }
    for i in 0..=30 {
        for j in 0..n {
            addval[i+1][j] = addval[i][j] + addval[i][(j+addval[i][j])%n];
        }
    }
    let mut result = vec![0usize; n];
    for i in 0..n {
        let mut idx = i;
        for j in 0..=31 {
            if ((k >> j) & 1) == 1 {
                result[i] += addval[j][idx];
                idx += addval[j][idx];
                idx %= n;
            }
        }
    }
    for i in 0..n {
        println!("{}", result[i]+i+1);
    }
}
0