結果
問題 |
No.3215 Make K types-able
|
ユーザー |
![]() |
提出日時 | 2025-07-25 22:52:58 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 91 ms / 4,000 ms |
コード長 | 2,136 bytes |
コンパイル時間 | 3,331 ms |
コンパイル使用メモリ | 285,152 KB |
実行使用メモリ | 11,196 KB |
最終ジャッジ日時 | 2025-09-04 05:14:08 |
合計ジャッジ時間 | 6,025 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 10 |
ソースコード
#if __INCLUDE_LEVEL__ == 0 #include __BASE_FILE__ using Mint = atcoder::modint998244353; void Solve() { constexpr int N = 2e5; constexpr int K = 9; vector<array<Mint, K + 1>> f(N + 1); f[1][0] = 1; f[1][1] = 1; Mint b = 2; for (int n : Rep(1, N)) { b *= b; f[n + 1][0] = b; b *= 2; for (int x : Rep1(0, K)) { for (int y : Rep1(0, K)) { int z = x + y; if (z <= K) { f[n + 1][z] += f[n][x] * f[n][y]; } } } } int t; IN(t); while (t--) { int n, k; IN(n, k); --k; OUT(f[n][k]); } } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); Solve(); } #elif __INCLUDE_LEVEL__ == 1 #include <bits/stdc++.h> #include <atcoder/modint.hpp> template <class T> concept MyRange = std::ranges::range<T> && !std::convertible_to<T, std::string_view>; template <class T> concept MyTuple = std::__is_tuple_like<T>::value && !MyRange<T>; namespace std { istream& operator>>(istream& is, MyRange auto&& r) { for (auto&& e : r) is >> e; return is; } istream& operator>>(istream& is, MyTuple auto&& t) { apply([&](auto&... xs) { (is >> ... >> xs); }, t); return is; } ostream& operator<<(ostream& os, MyRange auto&& r) { auto sep = ""; for (auto&& e : r) os << exchange(sep, " ") << e; return os; } ostream& operator<<(ostream& os, MyTuple auto&& t) { auto sep = ""; apply([&](auto&... xs) { ((os << exchange(sep, " ") << xs), ...); }, t); return os; } template <class T, atcoder::internal::is_modint_t<T>* = nullptr> istream& operator>>(istream& is, T& x) { int v; is >> v; x = T::raw(v); return is; } template <class T, atcoder::internal::is_modint_t<T>* = nullptr> ostream& operator<<(ostream& os, const T& x) { return os << x.val(); } } // namespace std using namespace std; #define Rep(...) [](int l, int r) { return views::iota(min(l, r), r); }(__VA_ARGS__) #define Rep1(...) [](int l, int r) { return Rep(l, r + 1); }(__VA_ARGS__) #define IN(...) (cin >> forward_as_tuple(__VA_ARGS__)) #define OUT(...) (cout << forward_as_tuple(__VA_ARGS__) << '\n') #endif // __INCLUDE_LEVEL__ == 1