結果
問題 | No.10 +か×か |
ユーザー | roiti46 |
提出日時 | 2015-04-16 01:16:32 |
言語 | Python2 (2.7.18) |
結果 |
WA
|
実行時間 | - |
コード長 | 493 bytes |
コンパイル時間 | 47 ms |
コンパイル使用メモリ | 6,652 KB |
実行使用メモリ | 814,912 KB |
最終ジャッジ日時 | 2023-09-17 20:40:28 |
合計ジャッジ時間 | 5,240 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 13 ms
6,324 KB |
testcase_01 | AC | 14 ms
6,376 KB |
testcase_02 | WA | - |
testcase_03 | MLE | - |
testcase_04 | -- | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
ソースコード
from collections import defaultdict N = int(raw_input()) T = int(raw_input()) a = map(int, raw_input().split()) dp = set([a[0]]) s2e = defaultdict(lambda :"1"*51) s2e[a[0]] = "" for ai in a[1:]: ndp = set([]) for s in dp: if s+ai <= T: ndp.add(s+ai) s2e[s+ai] = min(s2e[s+ai], s2e[s]+"0") if s*ai <= T: ndp.add(s*ai) s2e[s*ai] = min(s2e[s*ai], s2e[s]+"1") dp = ndp print s2e[T].replace("1","*").replace("0","+")