結果
| 問題 | No.10 +か×か |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-04-16 01:16:32 |
| 言語 | PyPy2 (7.3.20) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 493 bytes |
| 記録 | |
| コンパイル時間 | 572 ms |
| コンパイル使用メモリ | 80,288 KB |
| 実行使用メモリ | 246,464 KB |
| 最終ジャッジ日時 | 2026-07-17 12:57:43 |
| 合計ジャッジ時間 | 5,485 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 WA * 10 |
ソースコード
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","+")