結果
| 問題 | No.1929 Exponential Sequence |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-05-28 00:22:57 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 660 bytes |
| 記録 | |
| コンパイル時間 | 464 ms |
| コンパイル使用メモリ | 84,804 KB |
| 実行使用メモリ | 187,556 KB |
| 最終ジャッジ日時 | 2026-05-28 00:23:06 |
| 合計ジャッジ時間 | 3,591 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 22 WA * 2 |
ソースコード
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()
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)