結果
問題 |
No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
|
ユーザー |
|
提出日時 | 2020-05-30 15:21:45 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 707 bytes |
コンパイル時間 | 2,034 ms |
コンパイル使用メモリ | 182,016 KB |
実行使用メモリ | 144,128 KB |
最終ジャッジ日時 | 2024-11-07 17:52:11 |
合計ジャッジ時間 | 4,705 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 MLE * 3 |
ソースコード
#pragma GCC optimize("O3", "unroll-loops") #include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double constexpr ll mod = 998244353LL; int main(void){ int N, Q; cin >> N >> Q; vector<int> A(N); for (int i = 0; i < N; ++i) cin >> A[i]; vector<vector<int>> DP(N + 1, vector<int>(N + 1, 0LL)); DP[0][0] = 1; for (int i = 0; i < N; ++i){ for (int j = 0; j < N; ++j){ DP[i + 1][j] = (DP[i + 1][j] + (int)(DP[i][j] * (A[i] - 1LL) % mod)) % mod; DP[i + 1][j + 1] = (DP[i + 1][j + 1] + DP[i][j]) % mod; } } while (Q--){ int B; cin >> B; cout << DP[N][B] << endl; } return 0; }