結果

問題 No.2344 (l+r)^2
ユーザー prussian_coderprussian_coder
提出日時 2023-06-11 08:34:06
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 508 bytes
コンパイル時間 278 ms
コンパイル使用メモリ 87,336 KB
実行使用メモリ 100,804 KB
最終ジャッジ日時 2023-08-31 01:50:27
合計ジャッジ時間 4,239 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,156 KB
testcase_01 AC 629 ms
78,916 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 83 ms
83,224 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

T=int(input())

def rep_mul(a,x,m):
	t=1
	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 solve():
	L,M=map(int,input().split())
	A=[int(x) for x in input().split()]
	m=1<<M
	if L>32:
		if L%2==0:
			X=L-32
		else:
			X=L-33
		A=[rep_mul(A[i],X,m)+rep_mul(A[i+X],X,m) for i in range(L-X)]

	print(process(A,m))
for _ in range(T):
	solve()
0