結果

問題 No.2391 SAN 値チェック
ユーザー qwewe
提出日時 2025-04-24 12:25:59
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 569 bytes
コンパイル時間 342 ms
コンパイル使用メモリ 82,596 KB
実行使用メモリ 79,792 KB
最終ジャッジ日時 2025-04-24 12:26:41
合計ジャッジ時間 2,647 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353
max_n = 200000

# Precompute factorials and inverse factorials
fact = [1] * (max_n + 1)
for i in range(1, max_n + 1):
    fact[i] = fact[i-1] * i % MOD

inv_fact = [1] * (max_n + 1)
inv_fact[max_n] = pow(fact[max_n], MOD-2, MOD)
for i in range(max_n - 1, -1, -1):
    inv_fact[i] = inv_fact[i+1] * (i+1) % MOD

N = int(input())
for i in range(N + 1):
    if i == 0:
        print(0)
    else:
        j = N - i
        if j % 2 == 0:
            sign = 1
        else:
            sign = MOD - 1
        res = sign * inv_fact[j] % MOD
        print(res)
0