結果
問題 | No.1430 Coup de Coupon |
ユーザー | tamato |
提出日時 | 2021-03-14 14:43:42 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,032 bytes |
コンパイル時間 | 272 ms |
コンパイル使用メモリ | 82,700 KB |
実行使用メモリ | 274,336 KB |
最終ジャッジ日時 | 2024-04-23 22:24:58 |
合計ジャッジ時間 | 5,108 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 33 ms
52,352 KB |
testcase_01 | AC | 37 ms
52,608 KB |
testcase_02 | RE | - |
testcase_03 | AC | 49 ms
66,944 KB |
testcase_04 | RE | - |
testcase_05 | AC | 39 ms
62,464 KB |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | AC | 50 ms
70,140 KB |
testcase_09 | AC | 162 ms
97,476 KB |
testcase_10 | AC | 229 ms
107,452 KB |
testcase_11 | AC | 309 ms
130,496 KB |
testcase_12 | AC | 401 ms
152,824 KB |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | AC | 531 ms
174,988 KB |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | AC | 81 ms
79,532 KB |
testcase_22 | AC | 34 ms
52,736 KB |
testcase_23 | AC | 42 ms
61,056 KB |
testcase_24 | RE | - |
testcase_25 | AC | 63 ms
72,320 KB |
testcase_26 | RE | - |
ソースコード
mod = 1000000007 eps = 10**-9 inf = 10**18 def main(): import sys input = sys.stdin.readline N, M = map(int, input().split()) P = [] for _ in range(N): P.append(int(input())) C1 = [] C2 = [] for _ in range(M): t, x = map(int, input().split()) if t == 1: C1.append(x) else: C2.append(x) C1.sort(reverse=True) C2.sort(reverse=True) P.sort(reverse=True) if len(C1) + len(C2) < N: for _ in range(N - M): C2.append(0) M = N dp = [[inf] * (len(C1) + 1) for _ in range(N+1)] dp[0][0] = 0 for i in range(N): p = P[i] for j in range(len(C1) + 1): # use C1 if j != len(C1): dp[i+1][j+1] = min(dp[i+1][j+1], dp[i][j] + max(0, p - C1[j])) # use C2 if i-j < len(C2): dp[i+1][j] = min(dp[i+1][j], dp[i][j] + p * (100 - C2[i - j]) // 100) print(min(dp[-1])) if __name__ == '__main__': main()