結果

問題 No.1839 Concatenation Matrix
ユーザー SumitacchanSumitacchan
提出日時 2022-01-15 16:13:26
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,258 bytes
コンパイル時間 4,255 ms
コンパイル使用メモリ 246,244 KB
実行使用メモリ 26,408 KB
最終ジャッジ日時 2024-05-01 13:27:34
合計ジャッジ時間 6,929 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

//test

#include <bits/stdc++.h>
#include <atcoder/convolution>
#include <atcoder/modint>
using namespace atcoder;
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)

using ll = long long;
const ll mod = 998244353;
using mint = modint998244353;

vector<mint> convolution_multi(vector<vector<mint>> P){
    int i = 0;
    while(i + 1 < (int)P.size()){
        auto prod = convolution(P[i], P[i + 1]);
        P.push_back(prod);
        i += 2;
    }
    return P.back();
}

signed main(){

    int N; cin >> N;
    vector<int> a(N);
    REP(i, N) cin >> a[i];

    vector<vector<mint>> P(N - 1, vector<mint>(2));
    mint r = 10;
    REP(i, N - 1){
        P[i][0] = 1;
        P[i][1] = r;
        r *= r;
    }
    auto f = convolution_multi(P);

    vector<mint> A(2 * N);
    REP(i, N){
        A[i] = a[i];
        A[i + N] = a[i];
    }

    auto ans = convolution(f, A);
    //test
    ans[N - 1 + N - 1] += 1;
    REP(i, N) cout << ans[N - 1 + i].val() << '\n';

    return 0;
}
0