結果

問題 No.1964 sum = length
ユーザー hiro71687khiro71687k
提出日時 2023-03-07 08:27:22
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,340 bytes
コンパイル時間 4,392 ms
コンパイル使用メモリ 265,948 KB
実行使用メモリ 203,532 KB
最終ジャッジ日時 2023-10-18 05:22:32
合計ジャッジ時間 15,619 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
6,268 KB
testcase_01 AC 3 ms
5,476 KB
testcase_02 AC 27 ms
21,316 KB
testcase_03 AC 3 ms
5,476 KB
testcase_04 AC 5 ms
6,268 KB
testcase_05 AC 6 ms
7,324 KB
testcase_06 AC 7 ms
8,380 KB
testcase_07 AC 8 ms
9,436 KB
testcase_08 AC 10 ms
10,228 KB
testcase_09 AC 11 ms
11,284 KB
testcase_10 AC 12 ms
12,340 KB
testcase_11 AC 14 ms
13,396 KB
testcase_12 AC 80 ms
46,132 KB
testcase_13 AC 120 ms
65,140 KB
testcase_14 AC 167 ms
87,052 KB
testcase_15 AC 189 ms
97,876 KB
testcase_16 AC 26 ms
20,260 KB
testcase_17 AC 93 ms
52,204 KB
testcase_18 AC 105 ms
58,276 KB
testcase_19 AC 64 ms
39,268 KB
testcase_20 AC 71 ms
42,172 KB
testcase_21 AC 24 ms
19,204 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
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 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll=int;
using ld=long double;
ld pie=3.14159265359;
ll inf=1001;
ll mod=998244353;
int main(){
	ll n;
	cin >> n;
	ll ans=0;
	vector<vector<vector<ll>>>dp(n,vector<vector<ll>>(500,vector<ll>(500,0)));
	for (ll i = 1; i < 10; i++)
	{
		dp[0][i][1]=1;
	}
	for (ll i = 10; i <100; i++)
	{
		dp[0][i][2]=1;
	}
	for (ll i = 100; i < n; i++)
	{
		dp[0][i][3]=1;
	}
	for (ll i = 1; i < n; i++)
	{
		for (ll j = 0; j < 450; j++)
		{
			for (ll k = 0; k < 450; k++)
			{
				if (dp[i-1][j][k]==0)
				{
					continue;
				}
				if (k+2>450)
				{
					continue;
				}
				for (ll l = 1; l < 10&&l+j<450; l++)
				{
					dp[i][j+l][k+2]+=dp[i-1][j][k];
					if (dp[i][j+l][k+2]>mod)
					{
						dp[i][j+l][k+2]-=mod;
					}
				}
				if (k+3>450)
				{
					continue;
				}
				for (ll l = 10; l < 100&&l+j<450; l++)
				{
					dp[i][j+l][k+3]+=dp[i-1][j][k];
					if (dp[i][j+l][k+3]>mod)
					{
						dp[i][j+l][k+3]-=mod;
					}
				}
				if (k+3>450)
				{
					continue;
				}
				for (ll l = 100; l < n&&l+j<450; l++)
				{
					dp[i][j+l][k+4]+=dp[i-1][j][k];
					if (dp[i][j+l][k+4]>mod)
					{
						dp[i][j+l][k+4]-=mod;
					}
				}
			}
		}
	}
	for (ll i = 0; i < 500; i++)
	{
		ans+=dp[n-1][i][i];
		ans%=mod;
	}
	cout << ans << endl;
}
0