結果

問題 No.1013 〇マス進む
ユーザー furafura
提出日時 2020-10-06 17:47:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 587 bytes
コンパイル時間 2,106 ms
コンパイル使用メモリ 204,820 KB
実行使用メモリ 27,920 KB
最終ジャッジ日時 2023-09-27 08:00:32
合計ジャッジ時間 10,703 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 3 ms
4,376 KB
testcase_14 AC 24 ms
14,976 KB
testcase_15 AC 44 ms
22,372 KB
testcase_16 AC 37 ms
20,516 KB
testcase_17 AC 22 ms
13,400 KB
testcase_18 AC 29 ms
15,708 KB
testcase_19 AC 17 ms
10,800 KB
testcase_20 AC 51 ms
26,600 KB
testcase_21 AC 20 ms
12,528 KB
testcase_22 AC 29 ms
16,240 KB
testcase_23 AC 9 ms
7,424 KB
testcase_24 AC 53 ms
27,260 KB
testcase_25 AC 52 ms
26,804 KB
testcase_26 AC 10 ms
7,232 KB
testcase_27 AC 18 ms
12,112 KB
testcase_28 AC 9 ms
7,300 KB
testcase_29 AC 50 ms
25,940 KB
testcase_30 AC 18 ms
11,024 KB
testcase_31 AC 32 ms
18,280 KB
testcase_32 AC 22 ms
14,404 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
testcase_61 AC 49 ms
27,912 KB
testcase_62 AC 46 ms
27,584 KB
testcase_63 AC 2 ms
4,380 KB
testcase_64 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int n,k; scanf("%d%d",&n,&k);
	vector<int> p(n);
	rep(i,n) scanf("%d",&p[i]);

	vector dbl(30,vector<pair<int,int>>(n));
	rep(i,n){
		if(i+p[i]<n) dbl[0][i]={i+p[i],0};
		else         dbl[0][i]={(i+p[i]-n),1};
	}
	for(int t=1;t<30;t++){
		rep(i,n){
			auto [i1,c1]=dbl[t-1][i];
			auto [i2,c2]=dbl[t-1][i1];
			dbl[t][i]={i2,c1+c2};
		}
	}

	rep(i,n){
		int x=i,c=0;
		rep(t,30) if(k>>t&1) {
			c+=dbl[t][x].second;
			x=dbl[t][x].first;
		}
		printf("%d\n",x+n*c+1);
	}

	return 0;
}
0