結果

問題 No.1013 〇マス進む
ユーザー kibunakibuna
提出日時 2020-03-20 22:19:07
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 311 ms / 2,000 ms
コード長 853 bytes
コンパイル時間 3,408 ms
コンパイル使用メモリ 169,876 KB
実行使用メモリ 34,284 KB
最終ジャッジ日時 2023-08-21 17:03:28
合計ジャッジ時間 12,202 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 3 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 3 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 5 ms
4,376 KB
testcase_14 AC 75 ms
18,068 KB
testcase_15 AC 153 ms
27,244 KB
testcase_16 AC 134 ms
25,144 KB
testcase_17 AC 66 ms
15,952 KB
testcase_18 AC 90 ms
19,100 KB
testcase_19 AC 46 ms
12,568 KB
testcase_20 AC 211 ms
32,648 KB
testcase_21 AC 57 ms
14,852 KB
testcase_22 AC 90 ms
19,736 KB
testcase_23 AC 22 ms
8,300 KB
testcase_24 AC 201 ms
33,644 KB
testcase_25 AC 203 ms
33,164 KB
testcase_26 AC 24 ms
8,280 KB
testcase_27 AC 51 ms
14,388 KB
testcase_28 AC 22 ms
8,608 KB
testcase_29 AC 195 ms
32,100 KB
testcase_30 AC 51 ms
13,028 KB
testcase_31 AC 115 ms
22,236 KB
testcase_32 AC 69 ms
17,412 KB
testcase_33 AC 84 ms
17,324 KB
testcase_34 AC 171 ms
25,704 KB
testcase_35 AC 157 ms
24,664 KB
testcase_36 AC 9 ms
4,556 KB
testcase_37 AC 7 ms
4,380 KB
testcase_38 AC 181 ms
28,080 KB
testcase_39 AC 48 ms
11,152 KB
testcase_40 AC 179 ms
25,704 KB
testcase_41 AC 30 ms
8,520 KB
testcase_42 AC 88 ms
16,764 KB
testcase_43 AC 49 ms
11,728 KB
testcase_44 AC 89 ms
17,620 KB
testcase_45 AC 73 ms
15,688 KB
testcase_46 AC 34 ms
9,140 KB
testcase_47 AC 81 ms
16,756 KB
testcase_48 AC 103 ms
19,144 KB
testcase_49 AC 188 ms
25,732 KB
testcase_50 AC 120 ms
22,240 KB
testcase_51 AC 114 ms
20,236 KB
testcase_52 AC 18 ms
6,500 KB
testcase_53 AC 25 ms
7,984 KB
testcase_54 AC 136 ms
24,456 KB
testcase_55 AC 38 ms
9,416 KB
testcase_56 AC 244 ms
30,264 KB
testcase_57 AC 141 ms
21,448 KB
testcase_58 AC 311 ms
34,148 KB
testcase_59 AC 285 ms
34,176 KB
testcase_60 AC 222 ms
34,284 KB
testcase_61 AC 224 ms
34,176 KB
testcase_62 AC 175 ms
34,148 KB
testcase_63 AC 1 ms
4,380 KB
testcase_64 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    lint n, k;
    cin >> n >> k;
    vector<lint> p(n);
    for (int i = 0; i < n; ++i) {
        cin >> p[i];
    }
    vector<vector<lint>> dbl(n, vector<lint>(35, 0));
    for (int i = 0; i < n; ++i) {
        dbl[i][0] = p[i];
    }
    for (int i = 1; i < 35; ++i) {
        for (int j = 0; j < n; ++j) {
            dbl[j][i] = dbl[j][i - 1] + dbl[(j + dbl[j][i - 1]) % n][i - 1];
        }
    }
    for (int i = 0; i < n; ++i) {
        lint curr = i;
        for (int j = 0; j < 35; ++j) {
            if (1LL << j & k) {
                curr += dbl[curr % n][j];
            }
        }
        cout << curr + 1 << "\n";
    }
    return 0;
}
0