結果
問題 |
No.3215 Make K types-able
|
ユーザー |
|
提出日時 | 2025-07-24 06:31:07 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 746 ms / 4,000 ms |
コード長 | 845 bytes |
コンパイル時間 | 1,020 ms |
コンパイル使用メモリ | 95,536 KB |
実行使用メモリ | 77,364 KB |
最終ジャッジ日時 | 2025-07-24 22:41:49 |
合計ジャッジ時間 | 10,534 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 10 |
ソースコード
#include<iostream> #include<vector> #include<atcoder/modint> using namespace std; using mint = atcoder::modint998244353; int main(){ int maxN = 1000000; vector DP(maxN+1,vector<mint>(10,0)); vector<mint> power2(maxN+2,2); for(int i = 1; i <= maxN+1; i++)power2[i] = power2[i-1] * power2[i-1]; DP[2] = {5,2,1,0,0,0,0,0,0,0}; for(int i = 3; i <= maxN; i++){ DP[i][0] = power2[i]/4; for(int from1 = 0; from1 < 10; from1++){ for(int from2 = 0; from2 < 10; from2++){ if(from1 + from2 > 9)break; DP[i][from1 + from2] += DP[i-1][from1] * DP[i-1][from2]; } } } int T; cin >> T; for(int testcase = 0; testcase < T; testcase++){ int N,K; cin >> N >> K; cout << DP[N][K-1].val() << endl; } return 0; }