結果

問題 No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
ユーザー CleyLCleyL
提出日時 2023-03-26 23:13:32
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 501 bytes
コンパイル時間 793 ms
コンパイル使用メモリ 73,684 KB
実行使用メモリ 285,440 KB
最終ジャッジ日時 2023-10-19 13:56:12
合計ジャッジ時間 5,382 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 171 ms
119,760 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 MLE -
testcase_11 AC 106 ms
71,244 KB
testcase_12 AC 78 ms
55,756 KB
testcase_13 AC 104 ms
73,316 KB
testcase_14 AC 113 ms
76,920 KB
testcase_15 MLE -
testcase_16 AC 48 ms
35,084 KB
testcase_17 AC 56 ms
40,112 KB
testcase_18 MLE -
testcase_19 AC 98 ms
68,892 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 MLE -
testcase_22 AC 3 ms
4,348 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 2 ms
4,348 KB
testcase_25 MLE -
testcase_26 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
  }
}
0