結果

問題 No.1068 #いろいろな色 / Red and Blue and more various colors (Hard)
ユーザー tktk_snsn
提出日時 2022-04-30 11:11:48
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,065 bytes
コンパイル時間 2,508 ms
コンパイル使用メモリ 155,696 KB
実行使用メモリ 50,092 KB
最終ジャッジ日時 2024-06-29 16:53:10
合計ジャッジ時間 10,797 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <iomanip>
#include <numeric>
#include <utility>
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b){ if (a < b){ a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b){ if (a > b){ a = b; return true; } return false; }

#include <atcoder/convolution>
#include <atcoder/modint>
using namespace atcoder;
using mint = modint998244353;



int main() {
    int N, Q; cin >> N >> Q;

    vector<vector<mint>> F;
    for(int i=0; i<N; ++i) {
        int a;
        scanf("%d", &a);
        vector<mint> x(2, 1);
        x[0] = a - 1;
        F.push_back(x);
    }

    int i = 0;
    while (i < F.size()) {
        if (i + 1 == F.size()) break;
        F.push_back(convolution(F[i], F[i+1]));
        i += 2;
    }

    auto G = F[F.size()-1];
    for(int j=0; j<Q; ++j) {
        int b; cin >> b;
        printf("%d\n", G[b].val());
    }
    return 0;
}
0