結果

問題 No.1013 〇マス進む
ユーザー iqueue02iqueue02
提出日時 2020-03-21 10:34:56
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 302 ms / 2,000 ms
コード長 649 bytes
コンパイル時間 1,520 ms
コンパイル使用メモリ 171,168 KB
実行使用メモリ 30,064 KB
最終ジャッジ日時 2023-08-22 22:31:04
合計ジャッジ時間 12,416 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 3 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 3 ms
4,380 KB
testcase_08 AC 3 ms
4,380 KB
testcase_09 AC 3 ms
4,376 KB
testcase_10 AC 3 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 3 ms
4,376 KB
testcase_13 AC 9 ms
4,380 KB
testcase_14 AC 110 ms
15,924 KB
testcase_15 AC 185 ms
23,880 KB
testcase_16 AC 165 ms
22,256 KB
testcase_17 AC 94 ms
14,388 KB
testcase_18 AC 119 ms
16,712 KB
testcase_19 AC 69 ms
11,260 KB
testcase_20 AC 223 ms
28,648 KB
testcase_21 AC 85 ms
13,612 KB
testcase_22 AC 123 ms
17,304 KB
testcase_23 AC 38 ms
7,740 KB
testcase_24 AC 228 ms
29,384 KB
testcase_25 AC 223 ms
29,048 KB
testcase_26 AC 40 ms
7,792 KB
testcase_27 AC 80 ms
12,912 KB
testcase_28 AC 39 ms
7,792 KB
testcase_29 AC 219 ms
28,120 KB
testcase_30 AC 76 ms
11,760 KB
testcase_31 AC 142 ms
19,616 KB
testcase_32 AC 103 ms
15,420 KB
testcase_33 AC 111 ms
15,452 KB
testcase_34 AC 192 ms
22,820 KB
testcase_35 AC 191 ms
21,468 KB
testcase_36 AC 13 ms
4,380 KB
testcase_37 AC 13 ms
4,380 KB
testcase_38 AC 207 ms
25,052 KB
testcase_39 AC 70 ms
10,204 KB
testcase_40 AC 216 ms
22,520 KB
testcase_41 AC 45 ms
7,960 KB
testcase_42 AC 114 ms
15,064 KB
testcase_43 AC 69 ms
10,664 KB
testcase_44 AC 131 ms
15,396 KB
testcase_45 AC 101 ms
14,096 KB
testcase_46 AC 51 ms
8,356 KB
testcase_47 AC 107 ms
14,940 KB
testcase_48 AC 128 ms
17,284 KB
testcase_49 AC 217 ms
22,548 KB
testcase_50 AC 155 ms
19,736 KB
testcase_51 AC 140 ms
17,860 KB
testcase_52 AC 28 ms
5,912 KB
testcase_53 AC 39 ms
7,212 KB
testcase_54 AC 169 ms
21,768 KB
testcase_55 AC 53 ms
8,648 KB
testcase_56 AC 236 ms
26,600 KB
testcase_57 AC 170 ms
19,204 KB
testcase_58 AC 302 ms
30,016 KB
testcase_59 AC 285 ms
30,032 KB
testcase_60 AC 253 ms
29,984 KB
testcase_61 AC 222 ms
29,928 KB
testcase_62 AC 213 ms
30,064 KB
testcase_63 AC 2 ms
4,376 KB
testcase_64 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;

int main(){
  int n, k;
  cin >> n >> k;
  vector<int> p(n);
  rep(i,n) cin >> p[i];
  vector<vector<ll>> to(33, vector<ll>(n));
  for (int i = 0; i < n; i++) to[0][i] = p[i];
  for (int i = 0; i < 32; i++) {
    for (int j = 0; j < n; j++) to[i + 1][j] =  to[i][j] + to[i][(j + to[i][j]) % n];
  }

  for (int i = 0; i < n; i++) {
    ll res = i;
    for (int j = 0; j < 32; j++) {
      if (k & (1 << j)) res += to[j][res % n];
    }
    cout << res + 1 << endl;
  }
  return 0;
}
0