結果

問題 No.10 +か×か
ユーザー miztom
提出日時 2024-03-12 16:09:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,883 ms / 5,000 ms
コード長 307 bytes
コンパイル時間 390 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 332,560 KB
最終ジャッジ日時 2024-09-29 22:21:31
合計ジャッジ時間 5,888 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import*
n=int(input())
t=int(input())
a=map(int,input().split())
d=defaultdict(lambda:" "*n)
d[next(a)]=""
for i in a:
    e=defaultdict(lambda:" "*n)
    for j in d:
        if(p:=j+i)<=t:e[p]=max(e[p],d[j]+"+")
        if(p:=j*i)<=t:e[p]=max(e[p],d[j]+"*")
    del d;d=e;del e
print(d[t])
0