結果

問題 No.1310 量子アニーリング
ユーザー titiatitia
提出日時 2020-12-07 06:20:55
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 161 ms / 2,000 ms
コード長 517 bytes
コンパイル時間 1,522 ms
コンパイル使用メモリ 81,548 KB
実行使用メモリ 107,456 KB
最終ジャッジ日時 2023-10-17 15:57:08
合計ジャッジ時間 4,752 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
89,176 KB
testcase_01 AC 60 ms
89,176 KB
testcase_02 AC 60 ms
89,176 KB
testcase_03 AC 60 ms
89,176 KB
testcase_04 AC 59 ms
89,176 KB
testcase_05 AC 60 ms
89,176 KB
testcase_06 AC 61 ms
89,176 KB
testcase_07 AC 60 ms
89,176 KB
testcase_08 AC 59 ms
89,176 KB
testcase_09 AC 59 ms
89,176 KB
testcase_10 AC 61 ms
89,176 KB
testcase_11 AC 67 ms
91,752 KB
testcase_12 AC 76 ms
95,912 KB
testcase_13 AC 96 ms
101,720 KB
testcase_14 AC 111 ms
105,080 KB
testcase_15 AC 120 ms
105,872 KB
testcase_16 AC 123 ms
105,872 KB
testcase_17 AC 144 ms
107,456 KB
testcase_18 AC 159 ms
102,704 KB
testcase_19 AC 119 ms
105,608 KB
testcase_20 AC 90 ms
99,160 KB
testcase_21 AC 82 ms
98,652 KB
testcase_22 AC 161 ms
102,704 KB
testcase_23 AC 98 ms
101,752 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