結果

問題 No.1013 〇マス進む
ユーザー koi_kotyakoi_kotya
提出日時 2020-03-20 22:33:36
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 106 ms / 2,000 ms
コード長 1,238 bytes
コンパイル時間 1,829 ms
コンパイル使用メモリ 170,876 KB
実行使用メモリ 29,308 KB
最終ジャッジ日時 2023-08-21 17:20:13
合計ジャッジ時間 7,986 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 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,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,384 KB
testcase_13 AC 5 ms
4,492 KB
testcase_14 AC 45 ms
15,728 KB
testcase_15 AC 72 ms
23,540 KB
testcase_16 AC 65 ms
21,764 KB
testcase_17 AC 39 ms
14,132 KB
testcase_18 AC 49 ms
16,484 KB
testcase_19 AC 29 ms
11,024 KB
testcase_20 AC 87 ms
27,880 KB
testcase_21 AC 35 ms
13,184 KB
testcase_22 AC 49 ms
17,348 KB
testcase_23 AC 17 ms
7,540 KB
testcase_24 AC 90 ms
28,752 KB
testcase_25 AC 89 ms
28,136 KB
testcase_26 AC 17 ms
7,736 KB
testcase_27 AC 33 ms
12,752 KB
testcase_28 AC 17 ms
7,864 KB
testcase_29 AC 85 ms
27,348 KB
testcase_30 AC 32 ms
11,572 KB
testcase_31 AC 57 ms
19,176 KB
testcase_32 AC 41 ms
15,208 KB
testcase_33 AC 46 ms
15,316 KB
testcase_34 AC 74 ms
22,424 KB
testcase_35 AC 73 ms
21,308 KB
testcase_36 AC 7 ms
4,620 KB
testcase_37 AC 6 ms
4,564 KB
testcase_38 AC 80 ms
24,192 KB
testcase_39 AC 28 ms
9,916 KB
testcase_40 AC 77 ms
22,436 KB
testcase_41 AC 20 ms
7,816 KB
testcase_42 AC 46 ms
14,672 KB
testcase_43 AC 29 ms
10,412 KB
testcase_44 AC 48 ms
15,380 KB
testcase_45 AC 43 ms
13,932 KB
testcase_46 AC 22 ms
8,180 KB
testcase_47 AC 44 ms
14,660 KB
testcase_48 AC 52 ms
16,568 KB
testcase_49 AC 77 ms
22,164 KB
testcase_50 AC 63 ms
19,108 KB
testcase_51 AC 56 ms
17,884 KB
testcase_52 AC 13 ms
6,332 KB
testcase_53 AC 17 ms
7,496 KB
testcase_54 AC 69 ms
21,060 KB
testcase_55 AC 23 ms
8,324 KB
testcase_56 AC 93 ms
25,784 KB
testcase_57 AC 64 ms
18,636 KB
testcase_58 AC 106 ms
29,132 KB
testcase_59 AC 106 ms
29,244 KB
testcase_60 AC 100 ms
29,300 KB
testcase_61 AC 89 ms
29,244 KB
testcase_62 AC 86 ms
29,308 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;

typedef long long ll;
typedef pair<int,int> P;

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

template<typename T1,typename T2>ostream& operator<<(ostream& os,const pair<T1,T2>& a) {os << "(" << a.first << ", " << a.second << ")";return os;}

const char newl = '\n';

int main() {
    int n,k;
    cin >> n >> k;
    vector<int> p(n);
    vector<vector<ll>> a(32,vector<ll>(n));
    for (int i = 0;i < n;++i) cin >> p[i];
    // for (int i = 0;i < n;++i) a[0][i] = i;
    for (int i = 0;i < n;++i) a[1][i] = p[i];
    for (int i = 1;i < 31;++i) for (int j = 0;j < n;++j) {
        a[i+1][j] = a[i][j]+a[i][(j+a[i][j])%n];
    }
    vector<ll> ans(n);
    for (int i = 0;i < n;++i) ans[i] = i;
    for (int i = 1;i < 32;++i) {
        if (k&1) for (int j = 0;j < n;++j) ans[j] = ans[j]+a[i][ans[j]%n];
        k /= 2;
    }
    for (int i = 0;i < n;++i) cout << ans[i]+1 << newl;
}
0