結果

問題 No.10 +か×か
ユーザー miztommiztom
提出日時 2024-03-12 16:09:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,618 ms / 5,000 ms
コード長 307 bytes
コンパイル時間 273 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 332,376 KB
最終ジャッジ日時 2024-03-12 16:09:17
合計ジャッジ時間 5,672 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 AC 36 ms
53,460 KB
testcase_02 AC 36 ms
53,460 KB
testcase_03 AC 1,618 ms
324,128 KB
testcase_04 AC 106 ms
77,428 KB
testcase_05 AC 33 ms
55,616 KB
testcase_06 AC 1,521 ms
332,376 KB
testcase_07 AC 500 ms
186,428 KB
testcase_08 AC 208 ms
100,120 KB
testcase_09 AC 162 ms
87,068 KB
testcase_10 AC 37 ms
55,616 KB
testcase_11 AC 35 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

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