結果

問題 No.1929 Exponential Sequence
ユーザー lilictakalilictaka
提出日時 2022-05-21 11:27:05
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,049 bytes
コンパイル時間 210 ms
コンパイル使用メモリ 81,844 KB
実行使用メモリ 76,168 KB
最終ジャッジ日時 2023-10-20 15:51:00
合計ジャッジ時間 4,655 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
69,256 KB
testcase_01 AC 69 ms
76,088 KB
testcase_02 AC 146 ms
76,168 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
from itertools import product 
n,S = map(int,input().split())
A = list(map(int,input().split()))
cntP = defaultdict(int)
cntQ = defaultdict(int)
if n >= 2:
    front = []
    back = []
    for a in A[:n//2]:
        front .append(a)
    for a in A[n//2:]:
        back.append(a)
    for Ks in product([i for i in range(1,33)],repeat = len(front)):
        P = 0
        for l in range(len(front)):
            P += pow(front[l],Ks[l])

        if P <= S:
            cntP[P] += 1
    for Ks in product([i for i in range(1,33)],repeat=len(back)):
        Q = 0
        for l in range(len(back)):
            Q += pow(back[l],Ks[l])
        if Q <= S:
            cntQ[Q] += 1
    ans = 0
    for p in cntP.keys():
        for q in cntQ.keys():
            if p + q <= S:
                ans += cntP[p] * cntQ[q]
    print(ans)
else:
    for k in range(1,33):
        if pow(A[0],k) <= S:
            pass
        else:
            break
    print(k-1)


    






    
    

    

 

    


        
        




0