結果
問題 | No.2344 (l+r)^2 |
ユーザー | prussian_coder |
提出日時 | 2023-06-11 09:02:35 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 549 bytes |
コンパイル時間 | 533 ms |
コンパイル使用メモリ | 87,048 KB |
実行使用メモリ | 86,880 KB |
最終ジャッジ日時 | 2023-08-31 01:51:01 |
合計ジャッジ時間 | 7,004 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 70 ms
75,692 KB |
testcase_01 | AC | 625 ms
78,868 KB |
testcase_02 | AC | 320 ms
82,124 KB |
testcase_03 | AC | 328 ms
80,844 KB |
testcase_04 | AC | 328 ms
83,404 KB |
testcase_05 | AC | 341 ms
83,668 KB |
testcase_06 | AC | 337 ms
81,692 KB |
testcase_07 | AC | 129 ms
83,384 KB |
testcase_08 | AC | 129 ms
84,488 KB |
testcase_09 | AC | 156 ms
81,924 KB |
testcase_10 | TLE | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
ソースコード
T=int(input()) def rep_mul(a,x,m): t=0 val=a while t<x: if val==0 or val==1: return val val*=a val%=m t+=1 return val def process(A,m): N=len(A) if N==1: return A[0] B=[(A[i]+A[i+1])**2%m for i in range(N-1)] return process(B,m) def find_min_2x(N): return 1<<(len(bin(N))-3) def solve(): L,M=map(int,input().split()) A=[int(x) for x in input().split()] m=1<<M while L>40: X = find_min_2x(L-30) A=[rep_mul(A[i],X,m)+rep_mul(A[i+X],X,m) for i in range(L-X)] L-=X print(process(A,m)) for _ in range(T): solve()