結果

問題 No.2817 Competition
ユーザー hitonanode
提出日時 2024-07-19 22:47:00
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 257 ms / 2,000 ms
コード長 692 bytes
コンパイル時間 2,565 ms
コンパイル使用メモリ 142,036 KB
実行使用メモリ 9,484 KB
最終ジャッジ日時 2024-07-19 22:47:07
合計ジャッジ時間 5,976 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#include <atcoder/convolution>
#include <atcoder/modint>

using mint = atcoder::modint998244353;

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);

    int N;
    cin >> N;

    vector<long long> A(N);
    for (auto &a : A) cin >> a;

    auto rec = [&](auto &&self, int l, int r) -> vector<mint> {
        if (l + 1 == r) return {1, A.at(l)};
        const int c = (l + r) / 2;
        return atcoder::convolution(self(self, l, c), self(self, c, r));
    };

    vector<mint> dp = rec(rec, 0, N);

    mint ret = 0;
    for (int n = 1; n <= N; ++n) ret += dp.at(n) * mint(n).pow(N - n);

    cout << ret.val() << '\n';
}
0