結果
| 問題 | No.1929 Exponential Sequence |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-05-28 00:23:51 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 219 ms / 2,000 ms |
| コード長 | 700 bytes |
| 記録 | |
| コンパイル時間 | 361 ms |
| コンパイル使用メモリ | 84,960 KB |
| 実行使用メモリ | 187,436 KB |
| 最終ジャッジ日時 | 2026-05-28 00:23:56 |
| 合計ジャッジ時間 | 3,386 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_1 |
| 純コード判定待ち |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 24 |
ソースコード
def aa(x):
global s
res=[];p=1
for i in x:
c=[]
d=i
while s>=d:
c.append(d);d*=i
d=[]
if p:
res=c;p=0
continue
for j in res:
for l in c:
if j+l>s:
continue
d.append(j+l)
res=d
return res
n,s=map(int,input().split())
a=list(map(int,input().split()))
if sum(a)>s:
print(0)
exit()
if len(a)==1:
print(len(aa(a)));exit()
b=aa(a[:n//2]);c=aa(a[n//2:])
b.sort()
b=[0]+b;ans=0
for i in c:
q,w=0,len(b)
while w-q>1:
m=(q+w)//2
if b[m]+i<=s:
q=m
else:
w=m
ans+=q
print(ans)