結果
| 問題 |
No.286 Modulo Discount Store
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-05-16 09:47:13 |
| 言語 | Python2 (2.7.18) |
| 結果 |
AC
|
| 実行時間 | 344 ms / 2,000 ms |
| コード長 | 333 bytes |
| コンパイル時間 | 366 ms |
| コンパイル使用メモリ | 6,912 KB |
| 実行使用メモリ | 7,424 KB |
| 最終ジャッジ日時 | 2024-06-28 12:45:45 |
| 合計ジャッジ時間 | 3,258 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 40 |
ソースコード
#yuki286 N=int(raw_input()) M=[] for i in xrange(N): M.append(int(raw_input())) dp=[1<<20 for i in xrange(1<<N+1)] dp[0]=0 for m in xrange((1<<N)-1): t=0 for i in xrange(N): if m & (1<<i): t+=M[i] t%=1000 for i in xrange(N): if m & (1<<i)==0: dp[m | (1<<i)]=min(dp[m | (1<<i)],dp[m]+max(0,M[i]-t)) print dp[(1<<N)-1]