結果

問題 No.1310 量子アニーリング
ユーザー sotanishysotanishy
提出日時 2020-11-06 23:50:43
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 512 bytes
コンパイル時間 458 ms
コンパイル使用メモリ 86,760 KB
実行使用メモリ 840,648 KB
最終ジャッジ日時 2023-09-29 19:45:02
合計ジャッジ時間 5,940 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,304 KB
testcase_01 AC 75 ms
70,920 KB
testcase_02 AC 72 ms
71,144 KB
testcase_03 AC 73 ms
71,128 KB
testcase_04 AC 73 ms
71,316 KB
testcase_05 AC 73 ms
71,180 KB
testcase_06 AC 71 ms
70,968 KB
testcase_07 AC 72 ms
71,184 KB
testcase_08 AC 72 ms
70,916 KB
testcase_09 AC 73 ms
70,916 KB
testcase_10 AC 75 ms
71,324 KB
testcase_11 AC 94 ms
75,836 KB
testcase_12 AC 1,134 ms
108,112 KB
testcase_13 MLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
mod = 998244353

pow2 = [1] * (N + 1)
for i in range(1, N + 1):
    pow2[i] = pow2[i - 1] * 2 % mod
fact = [1] * (N + 1)
for i in range(1, N + 1):
    fact[i] = i * fact[i - 1] % mod
fact_inv = [1] * (N + 1)
fact_inv[N] = pow(fact[N], mod - 2, mod)
for i in range(1, N + 1)[::-1]:
    fact_inv[i - 1] = i * fact_inv[i]
comb = lambda n, k: fact[n] * fact_inv[k] * fact_inv[n - k] % mod

ans = 0
for k in range(0, N + 1, 2):
    ans = (ans + 2 * comb(N, k) * pow2[abs(N - 2 * k)]) % mod
print(ans)
0