結果

問題 No.10 +か×か
ユーザー roiti46roiti46
提出日時 2015-04-16 01:08:50
言語 PyPy2
(7.3.15)
結果
MLE  
実行時間 -
コード長 376 bytes
コンパイル時間 1,401 ms
コンパイル使用メモリ 77,372 KB
実行使用メモリ 813,340 KB
最終ジャッジ日時 2023-09-17 20:37:49
合計ジャッジ時間 6,746 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
76,312 KB
testcase_01 AC 75 ms
76,124 KB
testcase_02 AC 74 ms
76,300 KB
testcase_03 MLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(raw_input())
T = int(raw_input())
a = map(int, raw_input().split())
dp = set([(a[0],"")])

for ai in a[1:]:
    ndp = set([])
    for s, e in dp:
        if s+ai <= T: ndp.add((s+ai, e+"0"))
        if s*ai <= T: ndp.add((s*ai, e+"1"))
    dp = ndp
    
ans = "1"*100
for s, e in dp:
    if s == T:
        ans = min(ans, e)
print ans.replace("1","*").replace("0","+")
0