結果
問題 |
No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
|
ユーザー |
![]() |
提出日時 | 2020-05-29 21:36:15 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 596 bytes |
コンパイル時間 | 1,691 ms |
コンパイル使用メモリ | 173,408 KB |
実行使用メモリ | 285,184 KB |
最終ジャッジ日時 | 2024-11-06 02:47:03 |
合計ジャッジ時間 | 4,251 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 2 WA * 16 MLE * 6 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<ll, ll> P; typedef vector<ll> VI; typedef vector<VI> VVI; const ll MOD = 1000000007; const ll INF = 4611686018427387903; #define REP(i, n) for (int i = 0; i < n; i++) #define ALL(v) v.begin(), v.end() int main(){ int n, q; cin >> n >> q; VI a(n); REP(i,n) cin >> a[i]; VVI dp(n+1,VI(n+1,0)); dp[0][0]=1; REP(i,n){ REP(j,i+1){ dp[i+1][j+1]+=dp[i][j]; dp[i+1][j]+=dp[i][j]*(a[i]-1); dp[i+1][j]%=MOD; } } VI b(q); REP(i,q) cin >> b[i]; REP(i,q){ cout << dp[n][b[i]] << endl; } return 0; }