結果

問題 No.1331 Moving Penguin
ユーザー 00 Sakuda00 Sakuda
提出日時 2024-04-03 19:19:21
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 753 bytes
コンパイル時間 2,692 ms
コンパイル使用メモリ 209,452 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-04-03 19:19:38
合計ジャッジ時間 16,127 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 3 ms
6,676 KB
testcase_02 AC 3 ms
6,676 KB
testcase_03 AC 3 ms
6,676 KB
testcase_04 WA -
testcase_05 AC 232 ms
6,676 KB
testcase_06 AC 233 ms
6,676 KB
testcase_07 AC 232 ms
6,676 KB
testcase_08 AC 230 ms
6,676 KB
testcase_09 AC 227 ms
6,676 KB
testcase_10 AC 229 ms
6,676 KB
testcase_11 AC 228 ms
6,676 KB
testcase_12 AC 227 ms
6,676 KB
testcase_13 AC 233 ms
6,676 KB
testcase_14 AC 229 ms
6,676 KB
testcase_15 AC 228 ms
6,676 KB
testcase_16 AC 231 ms
6,676 KB
testcase_17 AC 230 ms
6,676 KB
testcase_18 AC 230 ms
6,676 KB
testcase_19 AC 230 ms
6,676 KB
testcase_20 AC 230 ms
6,676 KB
testcase_21 AC 228 ms
6,676 KB
testcase_22 AC 229 ms
6,676 KB
testcase_23 AC 233 ms
6,676 KB
testcase_24 AC 225 ms
6,676 KB
testcase_25 AC 232 ms
6,676 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 233 ms
6,676 KB
testcase_36 AC 234 ms
6,676 KB
testcase_37 AC 232 ms
6,676 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 234 ms
6,676 KB
testcase_42 AC 235 ms
6,676 KB
testcase_43 AC 233 ms
6,676 KB
testcase_44 AC 234 ms
6,676 KB
testcase_45 AC 233 ms
6,676 KB
testcase_46 AC 249 ms
6,676 KB
testcase_47 AC 231 ms
6,676 KB
testcase_48 AC 229 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace atcoder;
using namespace std;
using mint = modint;
using ll = long long;
int X = 500;
int main() {
	mint::set_mod((ll)1e9 + 7);
	int N;cin >> N;
	vector<int> A(N + 1, 0);
	for (int i = 1;i <= N;i++) cin >> A[i];
	vector<mint> dp(N + 1, 0);dp[N] = 1;
	vector<vector<mint>> sdp(X + 1, vector<mint>(X, 0));
	for (int i = 1;i <= X;i++) sdp[i][N % i] += 1;
	for (int i = N - 1;i >= 1;i--) {
		if (A[i] > X) {
			int now = A[i] + i;
			while (now <= N) dp[i] += dp[now],now += A[i];
		} else {
			if (A[i] == 1) {
				dp[i] += sdp[1][0];
			} else {
				dp[i] = dp[i + 1] + sdp[A[i]][i % A[i]];
			}
		}
		for (int j = 1;j <= X;j++) sdp[j][i % j] += dp[i];
	}
	cout << dp[1].val() << endl;
}
0