結果

問題 No.1013 〇マス進む
ユーザー pekempeypekempey
提出日時 2020-03-20 21:47:30
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 94 ms / 2,000 ms
コード長 745 bytes
コンパイル時間 1,531 ms
コンパイル使用メモリ 170,956 KB
実行使用メモリ 8,080 KB
最終ジャッジ日時 2024-05-08 21:36:05
合計ジャッジ時間 6,839 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 3 ms
5,376 KB
testcase_14 AC 27 ms
5,632 KB
testcase_15 AC 47 ms
7,040 KB
testcase_16 AC 46 ms
6,560 KB
testcase_17 AC 23 ms
5,376 KB
testcase_18 AC 31 ms
5,652 KB
testcase_19 AC 18 ms
5,376 KB
testcase_20 AC 52 ms
7,680 KB
testcase_21 AC 24 ms
5,376 KB
testcase_22 AC 32 ms
5,760 KB
testcase_23 AC 10 ms
5,376 KB
testcase_24 AC 56 ms
7,884 KB
testcase_25 AC 54 ms
7,700 KB
testcase_26 AC 11 ms
5,376 KB
testcase_27 AC 21 ms
5,376 KB
testcase_28 AC 11 ms
5,376 KB
testcase_29 AC 50 ms
7,632 KB
testcase_30 AC 20 ms
5,376 KB
testcase_31 AC 35 ms
6,144 KB
testcase_32 AC 24 ms
5,376 KB
testcase_33 AC 40 ms
5,376 KB
testcase_34 AC 64 ms
6,656 KB
testcase_35 AC 63 ms
6,484 KB
testcase_36 AC 5 ms
5,376 KB
testcase_37 AC 5 ms
5,376 KB
testcase_38 AC 70 ms
7,040 KB
testcase_39 AC 23 ms
5,376 KB
testcase_40 AC 69 ms
6,784 KB
testcase_41 AC 17 ms
5,376 KB
testcase_42 AC 43 ms
5,376 KB
testcase_43 AC 24 ms
5,376 KB
testcase_44 AC 42 ms
5,392 KB
testcase_45 AC 35 ms
5,376 KB
testcase_46 AC 18 ms
5,376 KB
testcase_47 AC 36 ms
5,456 KB
testcase_48 AC 45 ms
5,680 KB
testcase_49 AC 69 ms
6,656 KB
testcase_50 AC 55 ms
6,144 KB
testcase_51 AC 48 ms
5,844 KB
testcase_52 AC 10 ms
5,376 KB
testcase_53 AC 15 ms
5,376 KB
testcase_54 AC 63 ms
6,464 KB
testcase_55 AC 20 ms
5,376 KB
testcase_56 AC 84 ms
7,312 KB
testcase_57 AC 56 ms
6,144 KB
testcase_58 AC 94 ms
8,080 KB
testcase_59 AC 94 ms
7,952 KB
testcase_60 AC 94 ms
8,076 KB
testcase_61 AC 50 ms
7,952 KB
testcase_62 AC 42 ms
8,064 KB
testcase_63 AC 1 ms
5,376 KB
testcase_64 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()

vector<ll> prod(vector<ll> a, vector<ll> b) {
  const int n = a.size();
  vector<ll> c(n);
  rep(i, n) {
    ll d = i + b[i];
    c[i] = b[i] + a[d % n];
  }
  return c;
}

// f(i, K)
vector<ll> power(vector<ll> a, int b) {
  const int n = a.size();
  vector<ll> res(n);
  while (b > 0) {
    if (b & 1) {
      res = prod(res, a);
    }
    a = prod(a, a);
    b >>= 1;
  }
  return res;
}

int main() {
  int N, K; cin >> N >> K;
  vector<ll> P(N);
  rep(i, N) cin >> P[i];
  P = power(P, K);
  rep(i, N) cout << P[i] + i + 1 << '\n';
}
0