結果

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

ソースコード

diff #

#include <bits/stdc++.h>

#include <atcoder/convolution>

using Int = int64_t;

using Mint = atcoder::modint998244353;

void Solve() {
  Int n;
  std::cin >> n;
  std::vector<std::vector<Mint>> f(2 * n);
  for (Int i = 0; i < n; ++i) {
    Int a;
    std::cin >> a;
    f[n + i] = {1, a};
  }
  for (Int i = n; 1 < i--;) {
    f[i] = atcoder::convolution(f[2 * i], f[2 * i + 1]);
  }
  Mint ans = 0;
  for (Int k = 1; k <= n; ++k) {
    ans += f[1][k] * Mint(k).pow(n - k);
  }
  std::cout << ans.val() << '\n';
}

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);

  Solve();
}
0