結果

問題 No.1013 〇マス進む
ユーザー 00 Sakuda00 Sakuda
提出日時 2024-04-03 23:19:19
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 321 ms / 2,000 ms
コード長 615 bytes
コンパイル時間 2,029 ms
コンパイル使用メモリ 207,024 KB
実行使用メモリ 35,840 KB
最終ジャッジ日時 2024-04-03 23:19:36
合計ジャッジ時間 14,803 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 3 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 4 ms
6,676 KB
testcase_08 AC 3 ms
6,676 KB
testcase_09 AC 3 ms
6,676 KB
testcase_10 AC 3 ms
6,676 KB
testcase_11 AC 3 ms
6,676 KB
testcase_12 AC 4 ms
6,676 KB
testcase_13 AC 10 ms
6,676 KB
testcase_14 AC 115 ms
18,944 KB
testcase_15 AC 193 ms
28,544 KB
testcase_16 AC 189 ms
26,368 KB
testcase_17 AC 98 ms
16,896 KB
testcase_18 AC 124 ms
19,968 KB
testcase_19 AC 76 ms
13,312 KB
testcase_20 AC 229 ms
34,176 KB
testcase_21 AC 91 ms
15,744 KB
testcase_22 AC 129 ms
20,608 KB
testcase_23 AC 40 ms
8,960 KB
testcase_24 AC 268 ms
35,200 KB
testcase_25 AC 235 ms
34,560 KB
testcase_26 AC 42 ms
8,960 KB
testcase_27 AC 84 ms
15,104 KB
testcase_28 AC 42 ms
8,960 KB
testcase_29 AC 228 ms
33,536 KB
testcase_30 AC 81 ms
13,824 KB
testcase_31 AC 149 ms
23,424 KB
testcase_32 AC 112 ms
18,304 KB
testcase_33 AC 114 ms
18,304 KB
testcase_34 AC 193 ms
27,136 KB
testcase_35 AC 194 ms
25,728 KB
testcase_36 AC 15 ms
6,676 KB
testcase_37 AC 14 ms
6,676 KB
testcase_38 AC 212 ms
29,568 KB
testcase_39 AC 71 ms
11,776 KB
testcase_40 AC 226 ms
26,880 KB
testcase_41 AC 47 ms
9,088 KB
testcase_42 AC 117 ms
17,664 KB
testcase_43 AC 74 ms
12,416 KB
testcase_44 AC 120 ms
18,432 KB
testcase_45 AC 105 ms
16,640 KB
testcase_46 AC 56 ms
9,600 KB
testcase_47 AC 112 ms
17,664 KB
testcase_48 AC 131 ms
20,096 KB
testcase_49 AC 213 ms
26,880 KB
testcase_50 AC 164 ms
23,424 KB
testcase_51 AC 145 ms
21,248 KB
testcase_52 AC 31 ms
6,784 KB
testcase_53 AC 43 ms
8,448 KB
testcase_54 AC 174 ms
25,600 KB
testcase_55 AC 58 ms
9,984 KB
testcase_56 AC 247 ms
31,616 KB
testcase_57 AC 170 ms
22,656 KB
testcase_58 AC 321 ms
35,840 KB
testcase_59 AC 289 ms
35,840 KB
testcase_60 AC 263 ms
35,840 KB
testcase_61 AC 231 ms
35,840 KB
testcase_62 AC 240 ms
35,840 KB
testcase_63 AC 2 ms
6,676 KB
testcase_64 AC 2 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
	int N;ll K;cin >> N >> K;
	vector<int> P(N, 0);
	for (int i = 0;i < N;i++) cin >> P[i];
	vector<vector<ll>> dp(40, vector<ll>(N, 0));
	for (int i = 0;i < N;i++) dp[0][i] = P[i];
	for (int i = 1;i < 40;i++) for (int j = 0;j < N;j++) {
		ll k = (j + dp[i - 1][j]) % N;
		dp[i][j] = dp[i - 1][j] + dp[i - 1][k];
	}
	for (int i = 0;i < N;i++) {
		ll ans = i;
		ll k = K;
		int c = 0;
		while (k != 0) {
			int m = k % 2;
			if (m == 1) {
				ans += dp[c][ans % N];	
			}
			k -= m;
			k /= 2;
			c++;
		}
		cout << ans + 1 << endl;
	}
}
0