結果
問題 |
No.3215 Make K types-able
|
ユーザー |
![]() |
提出日時 | 2025-07-25 22:11:22 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 537 ms / 4,000 ms |
コード長 | 756 bytes |
コンパイル時間 | 4,023 ms |
コンパイル使用メモリ | 253,528 KB |
実行使用メモリ | 11,516 KB |
最終ジャッジ日時 | 2025-09-03 18:23:53 |
合計ジャッジ時間 | 11,051 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 10 |
ソースコード
#include <stdio.h> #include <atcoder/all> #include <bits/stdc++.h> using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000005 #define Inf64 1000000000000000001LL mint dp[200005][10]; int main(){ dp[0][1] = 1; for(int i=1;i<200005;i++){ rep(j,10){ rep(k,10){ if(j+k<10){ dp[i][j+k] += dp[i-1][j] * dp[i-1][k]; } } } mint v = mint(2).pow(pow_mod(2, i, 998244352)-2); rep(j,10){ dp[i][j] += dp[i-1][j] * v * 2; } dp[i][0] += v * v; } int _t; cin>>_t; rep(_,_t){ int N,K; cin>>N>>K; N--; mint ans= dp[N][K-1]; if(K==1){ ans += mint(2).pow(pow_mod(2, N+1, 998244352)-2); } cout<<ans.val()<<endl; } return 0; }