結果

問題 No.1013 〇マス進む
ユーザー yakkiyakki
提出日時 2020-03-21 20:34:44
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 241 ms / 2,000 ms
コード長 1,200 bytes
コンパイル時間 1,161 ms
コンパイル使用メモリ 126,192 KB
実行使用メモリ 28,880 KB
最終ジャッジ日時 2023-08-25 01:38:09
合計ジャッジ時間 10,610 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 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 2 ms
4,380 KB
testcase_08 AC 2 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,380 KB
testcase_12 AC 3 ms
4,380 KB
testcase_13 AC 8 ms
4,376 KB
testcase_14 AC 90 ms
15,160 KB
testcase_15 AC 158 ms
22,728 KB
testcase_16 AC 137 ms
21,040 KB
testcase_17 AC 81 ms
13,492 KB
testcase_18 AC 101 ms
15,864 KB
testcase_19 AC 61 ms
11,048 KB
testcase_20 AC 190 ms
27,348 KB
testcase_21 AC 79 ms
12,740 KB
testcase_22 AC 108 ms
16,500 KB
testcase_23 AC 33 ms
7,536 KB
testcase_24 AC 189 ms
27,788 KB
testcase_25 AC 188 ms
27,776 KB
testcase_26 AC 37 ms
7,528 KB
testcase_27 AC 70 ms
12,264 KB
testcase_28 AC 35 ms
7,412 KB
testcase_29 AC 185 ms
26,868 KB
testcase_30 AC 65 ms
11,288 KB
testcase_31 AC 124 ms
18,920 KB
testcase_32 AC 94 ms
14,592 KB
testcase_33 AC 96 ms
14,888 KB
testcase_34 AC 158 ms
21,752 KB
testcase_35 AC 161 ms
20,444 KB
testcase_36 AC 12 ms
4,384 KB
testcase_37 AC 11 ms
4,376 KB
testcase_38 AC 175 ms
23,820 KB
testcase_39 AC 60 ms
9,708 KB
testcase_40 AC 175 ms
21,568 KB
testcase_41 AC 42 ms
7,448 KB
testcase_42 AC 97 ms
14,260 KB
testcase_43 AC 61 ms
10,104 KB
testcase_44 AC 102 ms
15,156 KB
testcase_45 AC 90 ms
13,520 KB
testcase_46 AC 43 ms
8,044 KB
testcase_47 AC 96 ms
14,060 KB
testcase_48 AC 112 ms
16,264 KB
testcase_49 AC 173 ms
21,588 KB
testcase_50 AC 142 ms
18,812 KB
testcase_51 AC 126 ms
16,924 KB
testcase_52 AC 25 ms
5,728 KB
testcase_53 AC 36 ms
6,888 KB
testcase_54 AC 149 ms
20,404 KB
testcase_55 AC 48 ms
8,508 KB
testcase_56 AC 206 ms
25,328 KB
testcase_57 AC 151 ms
18,040 KB
testcase_58 AC 241 ms
28,276 KB
testcase_59 AC 229 ms
28,704 KB
testcase_60 AC 225 ms
28,276 KB
testcase_61 AC 193 ms
28,880 KB
testcase_62 AC 199 ms
28,832 KB
testcase_63 AC 1 ms
4,380 KB
testcase_64 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
#include<unordered_map>
#include<unordered_set>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592
#define PI acos(-1.0);

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


int main(){
    int N,K; cin >> N >> K;
    vector<int> p(N);
    rep(i,N) cin >> p[i],p[i]--;
    vector<vector<ll>> next(31,vector<ll>(N));
    rep(i,N){
        next[0][i] = p[i]+1;
    }
    rep(i,30){
        rep(j,N){
            next[i+1][j] = next[i][j]+next[i][(j+next[i][j])%N];
        }
    }

    rep(i,N){
        ll ans = i; 
        for(int j = 30; j >= 0; j--){
            if(1<<j&K){
                ans += next[j][ans%N];
            }
        }
        cout << ans+1 << endl;
    }

}

0