結果

問題 No.613 Solitude by the window
ユーザー cielciel
提出日時 2017-12-14 09:27:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 75 ms / 2,000 ms
コード長 192 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 86,980 KB
実行使用メモリ 71,468 KB
最終ジャッジ日時 2023-08-21 04:06:35
合計ジャッジ時間 3,237 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
70,992 KB
testcase_01 AC 71 ms
71,468 KB
testcase_02 AC 73 ms
71,192 KB
testcase_03 AC 75 ms
71,312 KB
testcase_04 AC 72 ms
71,212 KB
testcase_05 AC 72 ms
71,232 KB
testcase_06 AC 75 ms
71,288 KB
testcase_07 AC 71 ms
71,176 KB
testcase_08 AC 72 ms
71,132 KB
testcase_09 AC 74 ms
71,380 KB
testcase_10 AC 73 ms
71,332 KB
testcase_11 AC 73 ms
71,392 KB
testcase_12 AC 73 ms
71,268 KB
testcase_13 AC 72 ms
71,224 KB
testcase_14 AC 71 ms
71,084 KB
testcase_15 AC 71 ms
71,208 KB
testcase_16 AC 71 ms
71,188 KB
testcase_17 AC 69 ms
71,204 KB
testcase_18 AC 71 ms
71,356 KB
testcase_19 AC 72 ms
71,272 KB
testcase_20 AC 72 ms
71,276 KB
testcase_21 AC 71 ms
70,916 KB
testcase_22 AC 71 ms
71,376 KB
testcase_23 AC 72 ms
71,336 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

k,M=map(int,input().split())
k=pow(2,k,M*M-1)
mul=lambda a,b:[(a[0]*b[0]+3*a[1]*b[1])%M,(a[1]*b[0]+b[1]*a[0])%M]
x=[2,1]
e=[1,0]
while k:
 if k%2:e=mul(e,x)
 x=mul(x,x);k//=2
print(2*~-e[0]%M)
0