結果
問題 |
No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
|
ユーザー |
👑 |
提出日時 | 2023-03-26 23:13:32 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 501 bytes |
コンパイル時間 | 685 ms |
コンパイル使用メモリ | 72,792 KB |
最終ジャッジ日時 | 2025-02-11 18:26:10 |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 MLE * 6 |
ソースコード
#include <iostream> #include <vector> using namespace std; const long long MOD = 998244353; long long dp[6010][6010]; int main(){ int n,q;cin>>n>>q; vector<int> A(n); for(int i = 0; n > i; i++){ cin>>A[i]; } dp[0][0] = 1; for(int i = 0; n > i; i++){ for(int j = 0; n > j; j++){ dp[i+1][j+1] = (dp[i+1][j+1]+dp[i][j])%MOD; dp[i+1][j] = (dp[i+1][j]+dp[i][j]*(A[i]-1))%MOD; } } for(int i = 0; q > i; i++){ int x;cin>>x; cout << dp[n][x] << endl; } }