結果

問題 No.10 +か×か
ユーザー TawaraTawara
提出日時 2015-12-14 23:11:31
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 1,140 ms / 5,000 ms
コード長 303 bytes
コンパイル時間 584 ms
コンパイル使用メモリ 76,672 KB
実行使用メモリ 283,496 KB
最終ジャッジ日時 2024-05-08 11:49:18
合計ジャッジ時間 4,014 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
75,264 KB
testcase_01 AC 70 ms
75,964 KB
testcase_02 AC 68 ms
75,904 KB
testcase_03 AC 1,048 ms
282,120 KB
testcase_04 AC 79 ms
77,824 KB
testcase_05 AC 71 ms
75,424 KB
testcase_06 AC 1,140 ms
283,496 KB
testcase_07 AC 319 ms
170,428 KB
testcase_08 AC 116 ms
90,880 KB
testcase_09 AC 97 ms
84,368 KB
testcase_10 AC 69 ms
75,392 KB
testcase_11 AC 69 ms
75,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = input()
T = input()
A = map(int,raw_input().split())
dp = {A[0]:""}
for i in xrange(1,N):
	tmp_dp = {}
	for k,v in dp.iteritems():
		for nk,nv in [(k+A[i],v+"+"),(k*A[i],v+"*")]:
			if nk <= T and (nk not in tmp_dp or tmp_dp[nk] < nv):
				tmp_dp[nk] = nv
	dp = tmp_dp
print dp[T] if T in dp else -1
0