結果

問題 No.1430 Coup de Coupon
ユーザー convexineqconvexineq
提出日時 2021-05-21 00:11:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 617 ms / 2,000 ms
コード長 567 bytes
コンパイル時間 211 ms
コンパイル使用メモリ 81,720 KB
実行使用メモリ 77,888 KB
最終ジャッジ日時 2024-04-18 14:10:25
合計ジャッジ時間 7,498 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
51,968 KB
testcase_01 AC 39 ms
52,096 KB
testcase_02 AC 36 ms
51,968 KB
testcase_03 AC 71 ms
75,648 KB
testcase_04 AC 66 ms
71,936 KB
testcase_05 AC 62 ms
70,016 KB
testcase_06 AC 434 ms
76,800 KB
testcase_07 AC 455 ms
77,888 KB
testcase_08 AC 92 ms
76,756 KB
testcase_09 AC 174 ms
77,696 KB
testcase_10 AC 236 ms
77,656 KB
testcase_11 AC 285 ms
76,928 KB
testcase_12 AC 338 ms
77,580 KB
testcase_13 AC 407 ms
77,312 KB
testcase_14 AC 466 ms
76,928 KB
testcase_15 AC 511 ms
77,056 KB
testcase_16 AC 562 ms
77,460 KB
testcase_17 AC 617 ms
77,460 KB
testcase_18 AC 405 ms
77,420 KB
testcase_19 AC 404 ms
77,696 KB
testcase_20 AC 246 ms
77,568 KB
testcase_21 AC 94 ms
76,400 KB
testcase_22 AC 39 ms
52,480 KB
testcase_23 AC 45 ms
60,160 KB
testcase_24 AC 59 ms
67,840 KB
testcase_25 AC 80 ms
76,548 KB
testcase_26 AC 112 ms
76,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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**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 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 = ndp
print(min(dp))
0