結果
問題 | No.31 悪のミックスジュース |
ユーザー | tnodino |
提出日時 | 2022-04-06 04:23:50 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 574 bytes |
コンパイル時間 | 292 ms |
コンパイル使用メモリ | 86,992 KB |
実行使用メモリ | 81,160 KB |
最終ジャッジ日時 | 2023-08-18 10:47:57 |
合計ジャッジ時間 | 3,876 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 70 ms
76,352 KB |
testcase_01 | AC | 169 ms
78,084 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | AC | 172 ms
81,060 KB |
testcase_05 | AC | 172 ms
81,160 KB |
testcase_06 | AC | 60 ms
71,120 KB |
testcase_07 | AC | 182 ms
76,524 KB |
testcase_08 | AC | 182 ms
76,436 KB |
testcase_09 | WA | - |
testcase_10 | AC | 61 ms
71,276 KB |
testcase_11 | AC | 96 ms
76,528 KB |
testcase_12 | AC | 145 ms
78,060 KB |
testcase_13 | AC | 68 ms
76,372 KB |
testcase_14 | AC | 180 ms
76,688 KB |
testcase_15 | AC | 88 ms
76,840 KB |
testcase_16 | AC | 113 ms
78,192 KB |
ソースコード
INF = 1<<64 N,V = map(int,input().split()) C = list(map(int,input().split())) S = [0] * (N + 1) for i in range(N): S[i+1] = S[i] + C[i] if V <= N: print(S[N]) exit() x = 1 for i in range(2,N+1): if S[i] / i < S[x] / x: x = i DP = [INF] * (1<<16) DP[0] = 0 for i in range(1,N+1): for L in range(1<<16): if L - i >= 0: DP[L] = min(DP[L-i] + S[i], DP[L]) V -= N ans = INF for i in range(1,N+1): K = V // i while V - (K * i) <= (1<<10) and K: K -= 1 ans = min(ans, S[i] * K + DP[V - (K * i)] + S[N]) print(ans)