結果

問題 No.286 Modulo Discount Store
ユーザー TawaraTawara
提出日時 2015-10-13 21:50:29
言語 Python2
(2.7.18)
結果
AC  
実行時間 311 ms / 2,000 ms
コード長 391 bytes
コンパイル時間 80 ms
コンパイル使用メモリ 6,680 KB
実行使用メモリ 12,076 KB
最終ジャッジ日時 2023-09-28 12:58:06
合計ジャッジ時間 3,224 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
6,116 KB
testcase_01 AC 13 ms
6,144 KB
testcase_02 AC 77 ms
7,364 KB
testcase_03 AC 13 ms
6,060 KB
testcase_04 AC 14 ms
6,076 KB
testcase_05 AC 12 ms
6,136 KB
testcase_06 AC 147 ms
8,044 KB
testcase_07 AC 12 ms
6,000 KB
testcase_08 AC 12 ms
5,980 KB
testcase_09 AC 11 ms
6,056 KB
testcase_10 AC 40 ms
6,432 KB
testcase_11 AC 12 ms
6,024 KB
testcase_12 AC 12 ms
6,064 KB
testcase_13 AC 73 ms
7,420 KB
testcase_14 AC 12 ms
6,056 KB
testcase_15 AC 13 ms
5,980 KB
testcase_16 AC 13 ms
6,028 KB
testcase_17 AC 311 ms
12,076 KB
testcase_18 AC 40 ms
6,532 KB
testcase_19 AC 12 ms
6,056 KB
testcase_20 AC 19 ms
6,132 KB
testcase_21 AC 12 ms
6,060 KB
testcase_22 AC 12 ms
5,956 KB
testcase_23 AC 74 ms
7,312 KB
testcase_24 AC 12 ms
6,056 KB
testcase_25 AC 26 ms
6,212 KB
testcase_26 AC 12 ms
5,984 KB
testcase_27 AC 26 ms
6,308 KB
testcase_28 AC 146 ms
8,072 KB
testcase_29 AC 12 ms
6,108 KB
testcase_30 AC 12 ms
5,960 KB
testcase_31 AC 15 ms
6,300 KB
testcase_32 AC 14 ms
6,068 KB
testcase_33 AC 12 ms
6,004 KB
testcase_34 AC 12 ms
6,004 KB
testcase_35 AC 13 ms
6,032 KB
testcase_36 AC 12 ms
5,956 KB
testcase_37 AC 25 ms
6,368 KB
testcase_38 AC 12 ms
6,040 KB
testcase_39 AC 145 ms
8,000 KB
testcase_40 AC 11 ms
6,172 KB
testcase_41 AC 12 ms
6,056 KB
testcase_42 AC 12 ms
6,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = input()
M = [input() for i in xrange(N)]
total = {0:0}
dp = {0:0}
for i in xrange(N):
	tmp_dp = dict()
	for k,v in dp.iteritems():
		for j in xrange(N):
			jbit = 1 << j
			if (jbit & k) != 0:
				continue
			nk = k|jbit
			total[nk] = total[k] + M[j]
			nv = v + max(0,M[j] - total[k]%1000)
			if not(nk in tmp_dp and nv >= tmp_dp[nk]):
				tmp_dp[nk] = nv
	dp = tmp_dp
print dp[2**N-1]
0