結果

問題 No.1430 Coup de Coupon
ユーザー rin204rin204
提出日時 2022-04-16 15:35:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 650 ms / 2,000 ms
コード長 791 bytes
コンパイル時間 196 ms
コンパイル使用メモリ 82,408 KB
実行使用メモリ 273,536 KB
最終ジャッジ日時 2024-06-07 14:19:34
合計ジャッジ時間 11,002 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
51,968 KB
testcase_01 AC 38 ms
51,968 KB
testcase_02 AC 37 ms
51,968 KB
testcase_03 AC 496 ms
272,896 KB
testcase_04 AC 63 ms
70,144 KB
testcase_05 AC 64 ms
69,760 KB
testcase_06 AC 511 ms
272,996 KB
testcase_07 AC 527 ms
273,152 KB
testcase_08 AC 525 ms
273,024 KB
testcase_09 AC 650 ms
273,260 KB
testcase_10 AC 646 ms
272,744 KB
testcase_11 AC 637 ms
273,220 KB
testcase_12 AC 620 ms
273,536 KB
testcase_13 AC 605 ms
272,768 KB
testcase_14 AC 589 ms
273,152 KB
testcase_15 AC 577 ms
273,152 KB
testcase_16 AC 564 ms
273,280 KB
testcase_17 AC 541 ms
273,152 KB
testcase_18 AC 610 ms
272,932 KB
testcase_19 AC 596 ms
272,896 KB
testcase_20 AC 213 ms
117,504 KB
testcase_21 AC 175 ms
105,728 KB
testcase_22 AC 39 ms
52,992 KB
testcase_23 AC 41 ms
52,864 KB
testcase_24 AC 55 ms
63,360 KB
testcase_25 AC 122 ms
84,704 KB
testcase_26 AC 101 ms
83,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, c = map(int, input().split())
P = [int(input()) for _ in range(n)]
P.sort(reverse = True)
t1 = []
t2 = []
for _ in range(c):
    t, c = map(int, input().split())
    if t == 1:
        t1.append(c)
    else:
        t2.append(c)

t1.sort(reverse = True)
t2.sort(reverse = True)
t1 += [0] * (n - len(t1))
t2 += [0] * (n - len(t2))

inf = 1 << 30
dp = [[inf] * (n + 1) for _ in range(n + 1)]
dp[0][0] = 0
for i in range(n + 1):
    for j in range(n + 1):
        if i + j > n:
            break
        p = P[i + j - 1]
        if i > 0:
            dp[i][j] = min(dp[i][j], dp[i - 1][j] + max(0, p - t1[i - 1]))
        if j > 0:
            dp[i][j] = min(dp[i][j], dp[i][j - 1] + p * (100 - t2[j - 1]) // 100)

ans = inf
for i in range(n + 1):
    ans = min(ans, dp[i][n - i])
print(ans)
0