結果
問題 | No.1430 Coup de Coupon |
ユーザー |
![]() |
提出日時 | 2021-05-21 00:11:30 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 643 ms / 2,000 ms |
コード長 | 567 bytes |
コンパイル時間 | 361 ms |
コンパイル使用メモリ | 82,716 KB |
実行使用メモリ | 77,988 KB |
最終ジャッジ日時 | 2024-10-10 07:23:05 |
合計ジャッジ時間 | 8,091 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 |
ソースコード
n,C = map(int,input().split())p = sorted(int(input()) for _ in range(n))[::-1]R = []S = []for _ in range(C):t,x = map(int,input().split())if t==1: R.append(x)else: S.append(x)R.sort(reverse=1)S.sort(reverse=1)Lc,Lp = len(R), len(S)INF = 10**18dp = [INF]*(Lc+1)dp[0] = 0for i,pi in enumerate(p):ndp = [x+pi for x in dp]for j in range(Lc+1):if j:ndp[j] = min(ndp[j], dp[j-1] + max(pi-R[j-1],0))if 0 <= i-j < Lp:ndp[j] = min(ndp[j], dp[j] + pi//100*(100-S[i-j]))dp = ndpprint(min(dp))