結果
問題 |
No.3215 Make K types-able
|
ユーザー |
![]() |
提出日時 | 2025-07-28 02:39:03 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 424 ms / 4,000 ms |
コード長 | 1,666 bytes |
コンパイル時間 | 3,803 ms |
コンパイル使用メモリ | 254,304 KB |
実行使用メモリ | 17,388 KB |
最終ジャッジ日時 | 2025-07-28 02:39:14 |
合計ジャッジ時間 | 9,999 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 10 |
ソースコード
#ifndef ONLINE_JUDGE #define _GLIBCXX_DEBUG #endif #include <bits/stdc++.h> #include <cassert> #include <atcoder/all> using namespace std; using namespace atcoder; using ll = long long; using mint = modint998244353; //using mint = modint1000000007; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repu(i, s, t) for (int i = (int)(s); i < (int)(t); i++) #define repd(i, s, t) for (int i = (int)(s)-1; i >= (int)(t); i--) #define all(v) v.begin(), v.end() void _u() { cerr << endl; } template <class H, class... T> void _u(H&& h, T&&... t) { cerr << h << ", "; _u(move(t)...); } #define U(...) { cerr << #__VA_ARGS__ << ": "; _u(__VA_ARGS__); } template<typename T> bool chmax(T &a, const T b) { if(a >= b) return false; a = b; return true; } template<typename T> bool chmin(T &a, const T b) { if(a <= b) return false; a = b; return true; } template<typename T> istream& operator>>(istream &in, vector<T> &a) { for(T &x: a) in >> x; return in; } template<typename T> ostream& operator<<(ostream &out, const vector<T> &a) { for(const T &x: a) out << x << ' '; return out; } const int di[] = {1, 0, -1, 0, 1, 1, -1, -1, 0}; const int dj[] = {0, 1, 0, -1, -1, 1, 1, -1, 0}; int main() { int t; cin >> t; const int M = 2e5 + 10; vector<vector<mint>> dp(M, vector<mint>(10)); dp[0][0] = dp[0][1] = 1; mint all_dp = 2; rep(i, M-1) { rep(j, 10) rep(k, 10) if(j+k < 10) dp[i+1][j+k] += dp[i][j] * dp[i][k]; dp[i+1][0] += all_dp * all_dp; all_dp = all_dp * all_dp * 2; } rep(i, t) { int n, k; cin >> n >> k; k--; cout << dp[n-1][k].val() << '\n'; } return 0; }