結果

問題 No.1430 Coup de Coupon
ユーザー convexineqconvexineq
提出日時 2021-05-20 23:55:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 529 ms / 2,000 ms
コード長 792 bytes
コンパイル時間 208 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 77,824 KB
最終ジャッジ日時 2024-04-18 14:10:17
合計ジャッジ時間 7,219 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
51,712 KB
testcase_01 AC 41 ms
51,968 KB
testcase_02 AC 42 ms
51,968 KB
testcase_03 AC 82 ms
74,240 KB
testcase_04 AC 80 ms
71,680 KB
testcase_05 AC 74 ms
69,760 KB
testcase_06 AC 484 ms
77,440 KB
testcase_07 AC 438 ms
77,220 KB
testcase_08 AC 107 ms
76,160 KB
testcase_09 AC 174 ms
77,824 KB
testcase_10 AC 217 ms
77,056 KB
testcase_11 AC 256 ms
77,696 KB
testcase_12 AC 304 ms
77,312 KB
testcase_13 AC 411 ms
77,568 KB
testcase_14 AC 397 ms
77,696 KB
testcase_15 AC 458 ms
77,312 KB
testcase_16 AC 474 ms
77,312 KB
testcase_17 AC 529 ms
77,788 KB
testcase_18 AC 375 ms
77,312 KB
testcase_19 AC 355 ms
77,568 KB
testcase_20 AC 225 ms
77,312 KB
testcase_21 AC 107 ms
76,416 KB
testcase_22 AC 43 ms
52,352 KB
testcase_23 AC 52 ms
60,160 KB
testcase_24 AC 64 ms
64,000 KB
testcase_25 AC 99 ms
76,416 KB
testcase_26 AC 121 ms
76,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,C = map(int,input().split())
p = [int(input()) for _ in range(n)]
const = []
per = []
for _ in range(C):
    t,x = map(int,input().split())
    if t==1:
        const.append(x)
    else:
        per.append(x)
p.sort(reverse=1)
const.sort(reverse=1)
per.sort(reverse=1)
Lc,Lp = len(const), len(per)
"""
dp[i][j] = i 個処理してconst を j 枚使った, つまり per は i-j 枚使った
"""
INF = 10**18
dp = [INF]*(Lc+1)
dp[0] = 0
for i,pi in enumerate(p):
    ndp = [x+pi for x in dp]
    for j in range(Lc+1):
        if i < j: break
        if i-j >= Lp: continue
        v = dp[j] + pi//100*(100-per[i-j])
        ndp[j] = min(ndp[j],v)
    for j in range(1,Lc+1):
        v = dp[j-1] + max(pi-const[j-1],0)
        ndp[j] = min(ndp[j],v)
    dp = ndp
    #print(dp)
print(min(dp))
0