結果

問題 No.1574 Swap and Repaint
ユーザー risujirohrisujiroh
提出日時 2021-06-27 15:12:26
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,047 bytes
コンパイル時間 2,168 ms
コンパイル使用メモリ 202,388 KB
実行使用メモリ 11,424 KB
最終ジャッジ日時 2024-04-14 13:53:41
合計ジャッジ時間 19,779 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 1 ms
6,944 KB
testcase_09 AC 8 ms
6,940 KB
testcase_10 AC 3 ms
6,940 KB
testcase_11 AC 4 ms
6,944 KB
testcase_12 AC 6 ms
6,944 KB
testcase_13 AC 4 ms
6,940 KB
testcase_14 AC 4 ms
6,940 KB
testcase_15 AC 7 ms
6,944 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 3 ms
6,944 KB
testcase_18 AC 5,443 ms
6,944 KB
testcase_19 TLE -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#include <atcoder/modint>

int main() {
  using namespace std;
  cin.tie(nullptr)->sync_with_stdio(false);
  int n;
  cin >> n;
  using Mint = atcoder::modint998244353;
  vector<Mint> a(n);
  for (auto&& e : a) {
    int v;
    cin >> v;
    e = Mint::raw(v);
  }
  vector<Mint> c(n);
  c[0] = 1 / Mint(2);
  for (int i = 1; i < n - 1; ++i) c[i] = c[i - 1] / (2 * i + 2);
  for (int i = 0; i < n - 1; ++i) c[i] = 1 - c[i];
  c.back() = n - accumulate(begin(c), end(c) - 1, Mint(0));
  Mint coeff = 1;
  for (int i = 1; i < n; ++i) coeff *= 4 * i;
  for (int s = 0; s <= n; ++s) {
    Mint ans;
    for (int i = 0; i < n; ++i) ans += c[i] * a[i];
    ans *= coeff;
    cout << ans.val() << '\n';
    vector<Mint> na(n);
    na[0] += a[0] * (n - 2);
    na[1] += a[0];
    for (int i = 1; i < n - 1; ++i) {
      na[i - 1] += a[i];
      na[i] += a[i] * (n - 3);
      na[i + 1] += a[i];
    }
    na[n - 2] += a[n - 1];
    na[n - 1] += a[n - 1] * (n - 2);
    a = move(na);
  }
}
0