結果

問題 No.1430 Coup de Coupon
ユーザー 👑 rin204rin204
提出日時 2022-04-16 15:35:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 631 ms / 2,000 ms
コード長 791 bytes
コンパイル時間 353 ms
コンパイル使用メモリ 87,040 KB
実行使用メモリ 274,984 KB
最終ジャッジ日時 2023-08-26 18:47:38
合計ジャッジ時間 11,612 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
71,336 KB
testcase_01 AC 64 ms
70,968 KB
testcase_02 AC 63 ms
71,116 KB
testcase_03 AC 485 ms
272,852 KB
testcase_04 AC 85 ms
76,524 KB
testcase_05 AC 82 ms
76,716 KB
testcase_06 AC 488 ms
274,724 KB
testcase_07 AC 513 ms
274,844 KB
testcase_08 AC 498 ms
274,736 KB
testcase_09 AC 631 ms
274,964 KB
testcase_10 AC 617 ms
274,812 KB
testcase_11 AC 609 ms
274,796 KB
testcase_12 AC 614 ms
274,796 KB
testcase_13 AC 604 ms
274,868 KB
testcase_14 AC 567 ms
274,912 KB
testcase_15 AC 570 ms
274,856 KB
testcase_16 AC 537 ms
274,856 KB
testcase_17 AC 536 ms
274,984 KB
testcase_18 AC 586 ms
274,752 KB
testcase_19 AC 591 ms
274,856 KB
testcase_20 AC 225 ms
128,956 KB
testcase_21 AC 183 ms
105,116 KB
testcase_22 AC 70 ms
71,396 KB
testcase_23 AC 66 ms
70,996 KB
testcase_24 AC 76 ms
76,112 KB
testcase_25 AC 131 ms
83,948 KB
testcase_26 AC 110 ms
81,988 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