結果
問題 | No.2788 4-33 Hard |
ユーザー | sibasyun |
提出日時 | 2024-06-24 22:52:50 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 4,208 bytes |
コンパイル時間 | 4,097 ms |
コンパイル使用メモリ | 275,228 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-24 22:52:59 |
合計ジャッジ時間 | 7,228 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 32 ms
6,944 KB |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | AC | 8 ms
6,940 KB |
testcase_09 | AC | 8 ms
6,944 KB |
testcase_10 | AC | 32 ms
6,940 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | AC | 24 ms
6,940 KB |
testcase_20 | WA | - |
testcase_21 | WA | - |
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 | AC | 33 ms
6,948 KB |
testcase_32 | AC | 33 ms
6,940 KB |
testcase_33 | AC | 33 ms
6,940 KB |
testcase_34 | AC | 32 ms
6,940 KB |
testcase_35 | AC | 32 ms
6,944 KB |
testcase_36 | AC | 33 ms
6,944 KB |
testcase_37 | AC | 32 ms
6,944 KB |
testcase_38 | AC | 32 ms
6,940 KB |
testcase_39 | AC | 31 ms
6,944 KB |
testcase_40 | AC | 33 ms
6,944 KB |
testcase_41 | AC | 31 ms
6,940 KB |
testcase_42 | AC | 32 ms
6,940 KB |
testcase_43 | AC | 31 ms
6,940 KB |
testcase_44 | AC | 32 ms
6,944 KB |
testcase_45 | AC | 32 ms
6,944 KB |
testcase_46 | AC | 32 ms
6,940 KB |
testcase_47 | AC | 33 ms
6,940 KB |
testcase_48 | AC | 33 ms
6,940 KB |
testcase_49 | AC | 32 ms
6,940 KB |
testcase_50 | WA | - |
testcase_51 | AC | 32 ms
6,944 KB |
testcase_52 | AC | 32 ms
6,940 KB |
testcase_53 | AC | 37 ms
6,944 KB |
testcase_54 | AC | 32 ms
6,940 KB |
testcase_55 | AC | 32 ms
6,940 KB |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> #include <algorithm> #include <iostream> #include <iomanip> #include <math.h> #include <random> #include <chrono> #include <cstdint> using namespace std; using namespace atcoder; using mint = modint998244353; // using mint = modint1000000007; using vi = vector<int>; using vvi = vector<vector<int>>; using vl = vector<long long>; using vvl = vector<vector<long long>>; using ll = long long; template <class T> using max_heap = priority_queue<T>; template <class T> using min_heap = priority_queue<T, vector<T>, greater<>>; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, f, n) for (int i = (int) f; i < (int)(n); i++) #define repd(i, n, l) for (int i = (int) n; i >= (int) l; i--) #define all(p) p.begin(),p.end() vector<pair<int, int>> dydx{{-1, 0}, {1, 0}, {0, -1 }, {0, 1}}; const ll inf = 1LL << 60; void print(){ putchar(' '); } void print(bool a){ printf("%d", a); } void print(int a){ printf("%d", a); } void print(unsigned a){ printf("%u", a); } void print(long a){ printf("%ld", a); } void print(long long a){ printf("%lld", a); } void print(unsigned long long a){ printf("%llu", a); } void print(char a){ printf("%c", a); } void print(char a[]){ printf("%s", a); } void print(const char a[]){ printf("%s", a); } void print(float a){ printf("%.15f", a); } void print(double a){ printf("%.15f", a); } void print(long double a){ printf("%.15Lf", a); } void print(const string& a){ for(auto&& i : a) print(i); } template<class T> void print(const complex<T>& a){ if(a.real() >= 0) print('+'); print(a.real()); if(a.imag() >= 0) print('+'); print(a.imag()); print('i'); } template<class T> void print(const vector<T>&); template<class T, size_t size> void print(const array<T, size>&); template<class T, class L> void print(const pair<T, L>& p); template<class T, size_t size> void print(const T (&)[size]); template<class T> void print(const vector<T>& a){ if(a.empty()) return; print(a[0]); for(auto i = a.begin(); ++i != a.end(); ){ putchar(' '); print(*i); } } template<class T> void print(const deque<T>& a){ if(a.empty()) return; print(a[0]); for(auto i = a.begin(); ++i != a.end(); ){ putchar(' '); print(*i); } } template<class T, size_t size> void print(const array<T, size>& a){ print(a[0]); for(auto i = a.begin(); ++i != a.end(); ){ putchar(' '); print(*i); } } template<class T, class L> void print(const pair<T, L>& p){ print(p.first); putchar(' '); print(p.second); } template<class T, size_t size> void print(const T (&a)[size]){ print(a[0]); for(auto i = a; ++i != end(a); ){ putchar(' '); print(*i); } } template<class T> void print(const T& a){ cout << a; } mint cmb(ll n, ll k){ ll mod = 998244353; if (k == 0) return mint(1); mint ret = 1; while (k){ ret *= n; n--; ret *= mint(k).inv(); k--; } return ret; } int main() { vector<vector<ll>> S(5, vl(34, 0)), T(5, vl(34, 0)); rep(i, 5) rep(j, 34) cin >> S[i][j]; rep(i, 5) rep(j, 34) cin >> T[i][j]; vector<vector<vector<mint>>> dp(10, vector<vector<mint>>(5, vector<mint>(34, 0))); dp[0][0][0] = 1; rep(i, 5) rep(j, 34){ vector<vector<vector<mint>>> ndp(10, vector<vector<mint>>(5, vector<mint>(34, 0))); ll num = S[i][j]; for (int ini = 0; ini <= 8; ini++){ for (int s1 = 0; s1 <= 4; s1++){ for (int s2 = 0; s2 <= 33; s2++){ int tar; if (num > 10) tar = 10; else tar = (int) num; rep(k, tar){ if (ini + k > 8) break; int ns1 = i * k + s1; int ns2 = j * k + s2; if (ns1 <= 4 && ns2 <= 33) ndp[ini + k][ns1][ns2] += dp[ini][s1][s2] * cmb(num, k); } } } } swap(dp, ndp); // if (i == 0 && j == 0) cout << num << ' ' << dp[2][0][0].val() << endl; } rep(i, 5){ for (int s1 = 0; s1 <= 4; s1++){ ll num = T[i][0]; if (i + s1 <= 4) dp[9][s1+i][33] += dp[8][s1][33] * num; } } cout << dp[9][4][33].val() << endl; return 0; }