結果

問題 No.1013 〇マス進む
ユーザー koi_kotyakoi_kotya
提出日時 2020-03-20 22:33:36
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 108 ms / 2,000 ms
コード長 1,238 bytes
コンパイル時間 1,713 ms
コンパイル使用メモリ 172,488 KB
実行使用メモリ 29,652 KB
最終ジャッジ日時 2024-05-08 22:49:29
合計ジャッジ時間 7,887 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 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 2 ms
5,376 KB
testcase_12 AC 3 ms
5,376 KB
testcase_13 AC 5 ms
5,376 KB
testcase_14 AC 44 ms
15,872 KB
testcase_15 AC 73 ms
23,680 KB
testcase_16 AC 66 ms
21,888 KB
testcase_17 AC 39 ms
14,336 KB
testcase_18 AC 51 ms
16,768 KB
testcase_19 AC 28 ms
11,392 KB
testcase_20 AC 88 ms
28,160 KB
testcase_21 AC 36 ms
13,412 KB
testcase_22 AC 52 ms
17,308 KB
testcase_23 AC 17 ms
7,808 KB
testcase_24 AC 91 ms
29,004 KB
testcase_25 AC 89 ms
28,416 KB
testcase_26 AC 18 ms
7,936 KB
testcase_27 AC 33 ms
12,764 KB
testcase_28 AC 18 ms
7,808 KB
testcase_29 AC 88 ms
27,704 KB
testcase_30 AC 31 ms
11,716 KB
testcase_31 AC 57 ms
19,456 KB
testcase_32 AC 42 ms
15,232 KB
testcase_33 AC 45 ms
15,236 KB
testcase_34 AC 74 ms
22,400 KB
testcase_35 AC 74 ms
21,340 KB
testcase_36 AC 7 ms
5,376 KB
testcase_37 AC 6 ms
5,376 KB
testcase_38 AC 81 ms
24,576 KB
testcase_39 AC 28 ms
9,984 KB
testcase_40 AC 79 ms
22,272 KB
testcase_41 AC 19 ms
7,808 KB
testcase_42 AC 47 ms
14,848 KB
testcase_43 AC 30 ms
10,624 KB
testcase_44 AC 48 ms
15,360 KB
testcase_45 AC 42 ms
14,060 KB
testcase_46 AC 21 ms
8,320 KB
testcase_47 AC 44 ms
14,720 KB
testcase_48 AC 53 ms
16,788 KB
testcase_49 AC 79 ms
22,272 KB
testcase_50 AC 63 ms
19,456 KB
testcase_51 AC 58 ms
17,700 KB
testcase_52 AC 13 ms
6,272 KB
testcase_53 AC 17 ms
7,680 KB
testcase_54 AC 70 ms
21,204 KB
testcase_55 AC 23 ms
8,704 KB
testcase_56 AC 95 ms
26,144 KB
testcase_57 AC 63 ms
18,816 KB
testcase_58 AC 107 ms
29,524 KB
testcase_59 AC 108 ms
29,520 KB
testcase_60 AC 101 ms
29,652 KB
testcase_61 AC 91 ms
29,524 KB
testcase_62 AC 91 ms
29,524 KB
testcase_63 AC 2 ms
5,376 KB
testcase_64 AC 1 ms
5,376 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