結果

問題 No.1839 Concatenation Matrix
ユーザー 👑 hitonanodehitonanode
提出日時 2021-12-12 23:37:30
言語 C++23(draft)
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 115 ms / 3,500 ms
コード長 900 bytes
コンパイル時間 2,630 ms
コンパイル使用メモリ 141,636 KB
実行使用メモリ 7,400 KB
最終ジャッジ日時 2023-10-13 18:59:43
合計ジャッジ時間 4,986 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,352 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 1 ms
4,352 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,352 KB
testcase_08 AC 3 ms
4,352 KB
testcase_09 AC 4 ms
4,352 KB
testcase_10 AC 29 ms
4,352 KB
testcase_11 AC 114 ms
7,400 KB
testcase_12 AC 114 ms
7,276 KB
testcase_13 AC 115 ms
7,356 KB
testcase_14 AC 115 ms
7,340 KB
testcase_15 AC 115 ms
7,312 KB
testcase_16 AC 79 ms
5,700 KB
testcase_17 AC 83 ms
5,584 KB
testcase_18 AC 100 ms
6,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;

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

int main() {
    cin.tie(nullptr), ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<mint> A(N);
    for (auto &a : A) {
        int x;
        cin >> x;
        a = x;
    }
    vector<mint> ps{10};
    while (int(ps.size()) < N) {
        auto b = ps.back();
        ps.push_back(b * b);
    }

    auto rec = [&](auto &&self, int l, int r) -> vector<mint> {
        if (l + 1 == r) return {1, ps[l]};
        int c = (l + r) / 2;
        return atcoder::convolution(self(self, l, c), self(self, c, r));
    };
    auto vs = atcoder::convolution(A, rec(rec, 0, N - 1));
    vector<mint> ret(N);
    for (int i = 0; i < int(vs.size()); ++i) ret[(i + 1) % ret.size()] += vs[i];
    for (auto x : ret) cout << x.val() << '\n';
}
0