結果

問題 No.1430 Coup de Coupon
ユーザー convexineqconvexineq
提出日時 2021-05-21 00:11:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 663 ms / 2,000 ms
コード長 567 bytes
コンパイル時間 509 ms
コンパイル使用メモリ 86,940 KB
実行使用メモリ 79,344 KB
最終ジャッジ日時 2023-07-31 14:02:50
合計ジャッジ時間 9,340 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,312 KB
testcase_01 AC 68 ms
71,200 KB
testcase_02 AC 70 ms
71,372 KB
testcase_03 AC 99 ms
77,592 KB
testcase_04 AC 104 ms
76,956 KB
testcase_05 AC 94 ms
76,756 KB
testcase_06 AC 480 ms
79,324 KB
testcase_07 AC 480 ms
79,092 KB
testcase_08 AC 122 ms
78,396 KB
testcase_09 AC 208 ms
78,932 KB
testcase_10 AC 274 ms
78,432 KB
testcase_11 AC 332 ms
79,344 KB
testcase_12 AC 382 ms
79,052 KB
testcase_13 AC 450 ms
78,768 KB
testcase_14 AC 508 ms
78,652 KB
testcase_15 AC 558 ms
79,064 KB
testcase_16 AC 614 ms
78,764 KB
testcase_17 AC 663 ms
78,904 KB
testcase_18 AC 435 ms
78,720 KB
testcase_19 AC 474 ms
78,588 KB
testcase_20 AC 285 ms
78,204 KB
testcase_21 AC 123 ms
78,188 KB
testcase_22 AC 75 ms
71,088 KB
testcase_23 AC 82 ms
75,884 KB
testcase_24 AC 95 ms
76,360 KB
testcase_25 AC 113 ms
77,708 KB
testcase_26 AC 144 ms
77,660 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