結果

問題 No.1929 Exponential Sequence
ユーザー roarisroaris
提出日時 2022-06-10 02:29:30
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 491 bytes
コンパイル時間 230 ms
コンパイル使用メモリ 81,460 KB
実行使用メモリ 365,636 KB
最終ジャッジ日時 2023-10-21 04:34:31
合計ジャッジ時間 7,635 ms
ジャッジサーバーID
(参考情報)
judge11 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
57,728 KB
testcase_01 AC 53 ms
67,208 KB
testcase_02 AC 101 ms
78,548 KB
testcase_03 AC 442 ms
134,260 KB
testcase_04 AC 1,896 ms
216,480 KB
testcase_05 AC 42 ms
55,392 KB
testcase_06 AC 40 ms
53,344 KB
testcase_07 AC 187 ms
82,196 KB
testcase_08 AC 40 ms
53,344 KB
testcase_09 AC 127 ms
79,560 KB
testcase_10 AC 43 ms
57,440 KB
testcase_11 AC 193 ms
85,440 KB
testcase_12 TLE -
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 bisect import *

def dfs1(s, dep):
    if dep==n//2:
        l1.append(s)
        return
    
    for k in range(1, 31):
        dfs1(s+pow(a[dep], k), dep+1)

def dfs2(s, dep):
    if dep==n:
        l2.append(s)
        return
    
    for k in range(1, 31):
        dfs2(s+pow(a[dep], k), dep+1)

n, S = map(int, input().split())
a = list(map(int, input().split()))
l1, l2 = [], []
dfs1(0, 0)
dfs2(0, n//2)
l2.sort()
ans = 0

for v in l1:
    ans += bisect_right(l2, S-v)

print(ans)
0