結果

問題 No.1013 〇マス進む
ユーザー pekempeypekempey
提出日時 2020-03-20 21:47:30
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 103 ms / 2,000 ms
コード長 745 bytes
コンパイル時間 2,865 ms
コンパイル使用メモリ 168,148 KB
実行使用メモリ 7,800 KB
最終ジャッジ日時 2023-08-21 16:04:33
合計ジャッジ時間 7,328 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,384 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 3 ms
4,380 KB
testcase_14 AC 29 ms
5,268 KB
testcase_15 AC 47 ms
6,904 KB
testcase_16 AC 42 ms
6,480 KB
testcase_17 AC 25 ms
4,992 KB
testcase_18 AC 32 ms
5,420 KB
testcase_19 AC 18 ms
4,700 KB
testcase_20 AC 52 ms
7,588 KB
testcase_21 AC 23 ms
4,908 KB
testcase_22 AC 33 ms
5,460 KB
testcase_23 AC 10 ms
4,376 KB
testcase_24 AC 58 ms
7,624 KB
testcase_25 AC 56 ms
7,536 KB
testcase_26 AC 11 ms
4,380 KB
testcase_27 AC 21 ms
5,016 KB
testcase_28 AC 10 ms
4,376 KB
testcase_29 AC 51 ms
7,656 KB
testcase_30 AC 21 ms
4,564 KB
testcase_31 AC 36 ms
5,932 KB
testcase_32 AC 26 ms
5,224 KB
testcase_33 AC 41 ms
5,228 KB
testcase_34 AC 67 ms
6,532 KB
testcase_35 AC 66 ms
6,368 KB
testcase_36 AC 6 ms
4,376 KB
testcase_37 AC 5 ms
4,376 KB
testcase_38 AC 73 ms
6,912 KB
testcase_39 AC 26 ms
4,380 KB
testcase_40 AC 73 ms
6,596 KB
testcase_41 AC 18 ms
4,376 KB
testcase_42 AC 44 ms
5,192 KB
testcase_43 AC 26 ms
4,412 KB
testcase_44 AC 45 ms
5,240 KB
testcase_45 AC 39 ms
5,020 KB
testcase_46 AC 20 ms
4,384 KB
testcase_47 AC 37 ms
5,132 KB
testcase_48 AC 46 ms
5,448 KB
testcase_49 AC 72 ms
6,460 KB
testcase_50 AC 59 ms
6,180 KB
testcase_51 AC 52 ms
5,676 KB
testcase_52 AC 11 ms
4,376 KB
testcase_53 AC 16 ms
4,380 KB
testcase_54 AC 66 ms
6,292 KB
testcase_55 AC 21 ms
4,376 KB
testcase_56 AC 91 ms
7,088 KB
testcase_57 AC 60 ms
5,868 KB
testcase_58 AC 99 ms
7,736 KB
testcase_59 AC 103 ms
7,792 KB
testcase_60 AC 96 ms
7,776 KB
testcase_61 AC 54 ms
7,760 KB
testcase_62 AC 42 ms
7,800 KB
testcase_63 AC 2 ms
4,380 KB
testcase_64 AC 2 ms
4,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