結果

問題 No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
ユーザー queeequeee
提出日時 2020-05-29 23:14:23
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 1,330 bytes
コンパイル時間 815 ms
コンパイル使用メモリ 84,548 KB
実行使用メモリ 285,184 KB
最終ジャッジ日時 2024-04-24 01:11:40
合計ジャッジ時間 3,993 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 124 ms
105,344 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 MLE -
testcase_11 AC 72 ms
60,416 KB
testcase_12 AC 55 ms
46,208 KB
testcase_13 AC 75 ms
62,336 KB
testcase_14 AC 78 ms
65,664 KB
testcase_15 MLE -
testcase_16 AC 34 ms
28,160 KB
testcase_17 AC 39 ms
32,256 KB
testcase_18 MLE -
testcase_19 AC 69 ms
58,240 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 MLE -
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 1 ms
5,376 KB
testcase_25 MLE -
testcase_26 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <functional>
#define DB puts("D")
#define pb push_back

using namespace std; using ll=long long; using ld=long double; const int INF=1e9; const ll LINF=1e18; const double dINF = 1e18; const ld ldINF = 1e18; const double EPS = 1e-6;
template<typename T, typename U, typename O> void caut(T a, U b, O c){cout<<"("<<a<<","<<b<<","<<c<<") ";}
template<typename T, typename U> void caut(T a, U b){cout<<"("<<a<<","<<b<<") ";}
template<typename T> void caut(T a){cout<<"("<<a<<") ";}
template<typename T> void input(T a[], int n){for(int i=0;i<n;i++) cin>>a[i];}
template<typename T, typename U> void input(T a[], U b[], int n){for(int i=0;i<n;i++) cin>>a[i]>>b[i];}
template<typename T, typename U, typename O> void input(T a[], U b[], O[], int n){for(int i=0;i<n;i++) cin>>a[i]>>b[i];}

using P=pair<double,int>;
const ll M = 998244353;

int main() {
  int n,q; cin>>n>>q;
  ll p[n+1][n+1]; fill(p[0],p[n+1],0LL); p[0][0]=1;
  ll a[n],b[q]; input(a,n); input(b,q);
  for(int i=0;i<n;i++) {
    for(int j=0;j<n;j++) {
      p[i+1][j] += p[i][j];
      p[i+1][j+1] += p[i][j] * (a[i]-1);
      p[i+1][j] %= M;
      p[i+1][j+1] %= M;
    }
  }
  for(int i=0;i<q;i++) {
    cout<<p[n][n-b[i]]<<endl;
  }
}
0