結果

問題 No.1310 量子アニーリング
ユーザー titiatitia
提出日時 2020-12-07 06:21:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 685 ms / 2,000 ms
コード長 517 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 11,928 KB
実行使用メモリ 25,932 KB
最終ジャッジ日時 2023-10-17 15:57:23
合計ジャッジ時間 7,406 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 149 ms
25,932 KB
testcase_01 AC 148 ms
25,932 KB
testcase_02 AC 147 ms
25,932 KB
testcase_03 AC 154 ms
25,932 KB
testcase_04 AC 149 ms
25,932 KB
testcase_05 AC 146 ms
25,932 KB
testcase_06 AC 148 ms
25,932 KB
testcase_07 AC 146 ms
25,932 KB
testcase_08 AC 147 ms
25,932 KB
testcase_09 AC 150 ms
25,932 KB
testcase_10 AC 147 ms
25,932 KB
testcase_11 AC 149 ms
25,932 KB
testcase_12 AC 161 ms
25,932 KB
testcase_13 AC 281 ms
25,932 KB
testcase_14 AC 352 ms
25,932 KB
testcase_15 AC 395 ms
25,932 KB
testcase_16 AC 414 ms
25,932 KB
testcase_17 AC 541 ms
25,932 KB
testcase_18 AC 676 ms
25,932 KB
testcase_19 AC 379 ms
25,932 KB
testcase_20 AC 241 ms
25,932 KB
testcase_21 AC 201 ms
25,932 KB
testcase_22 AC 685 ms
25,932 KB
testcase_23 AC 287 ms
25,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())

mod=998244353
FACT=[1]
for i in range(1,2*10**5+1):
    FACT.append(FACT[-1]*i%mod)

FACT_INV=[pow(FACT[-1],mod-2,mod)]
for i in range(2*10**5,0,-1):
    FACT_INV.append(FACT_INV[-1]*i%mod)

FACT_INV.reverse()

def Combi(a,b):
    if 0<=b<=a:
        return FACT[a]*FACT_INV[b]*FACT_INV[a-b]%mod
    else:
        return 0

ANS=0
for i in range(N):
    now=i-(N-1-i)
    if (now+1)%4==N%4:
        now=now+1
    else:
        now=now-1

    ANS=(ANS+2*Combi(N-1,i)*pow(2,abs(now),mod))%mod
print(ANS)
0