結果

問題 No.2817 Competition
コンテスト
ユーザー hitonanode
提出日時 2024-07-19 22:47:00
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 151 ms / 2,000 ms
コード長 692 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,319 ms
コンパイル使用メモリ 212,624 KB
実行使用メモリ 220,596 KB
最終ジャッジ日時 2026-04-02 18:45:43
合計ジャッジ時間 4,776 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge4_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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