結果

問題 No.2344 (l+r)^2
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2023-06-19 17:46:38
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,103 bytes
コンパイル時間 503 ms
コンパイル使用メモリ 86,720 KB
実行使用メモリ 105,736 KB
最終ジャッジ日時 2023-09-09 13:11:32
合計ジャッジ時間 12,098 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
75,676 KB
testcase_01 AC 217 ms
78,272 KB
testcase_02 AC 670 ms
79,532 KB
testcase_03 AC 674 ms
79,288 KB
testcase_04 AC 651 ms
78,820 KB
testcase_05 AC 667 ms
78,520 KB
testcase_06 AC 666 ms
79,608 KB
testcase_07 TLE -
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

答えを見た

30段になるまでは、mod2でやってok

"""

import sys
from sys import stdin


def nCr_Plane(n,r):
    if n < r or n < 0:
        return 0
    import math
    return math.factorial(n) // (math.factorial(n-r) * math.factorial(r))
    
def nCr_Lucas(n,r,mod):

    ret = 1
    while n > 0 and r > 0:
        ret = (ret * nCr_Plane(n % mod , r % mod)) % mod
        n //= mod
        r //= mod
    return ret


        
    

TT = int(stdin.readline())

for loop in range(TT):

    N,M = map(int,stdin.readline().split())

    A = list(map(int,stdin.readline().split()))
    FOOT = 32

    if len(A) >= FOOT:

        a_tmp = []

        for slide in range(FOOT):

            B = A[slide : slide + (N-FOOT+1)]

            #print (B)

            top = 0

            for i in range(len(B)):
                top ^= (B[i] % 2) * nCr_Lucas(len(B)-1,i,2)

            a_tmp.append(top)

        A = a_tmp

    mod = 2**M

    while len(A) > 1:
        B = []
        for i in range(len(A)-1):
            B.append( (A[i]+A[i+1])**2 % mod )
        A = B

    print (A[0] % mod)
0