結果

問題 No.1430 Coup de Coupon
ユーザー tcltktcltk
提出日時 2021-06-26 07:04:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,057 bytes
コンパイル時間 425 ms
コンパイル使用メモリ 86,972 KB
実行使用メモリ 85,088 KB
最終ジャッジ日時 2023-09-07 13:45:50
合計ジャッジ時間 11,900 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 213 ms
80,996 KB
testcase_01 AC 211 ms
81,000 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 233 ms
84,000 KB
testcase_05 AC 224 ms
83,908 KB
testcase_06 AC 598 ms
84,752 KB
testcase_07 WA -
testcase_08 AC 239 ms
84,652 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 514 ms
84,844 KB
testcase_19 WA -
testcase_20 AC 369 ms
85,088 KB
testcase_21 WA -
testcase_22 AC 221 ms
80,864 KB
testcase_23 AC 231 ms
83,428 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# from typing import *

import sys
import io
import math
import collections
import decimal
import itertools
import bisect
import heapq


def input():
    return sys.stdin.readline()[:-1]


# sys.setrecursionlimit(1000000)

# _INPUT = """1 2
# 2000
# 1 500
# 2 30
# """
# sys.stdin = io.StringIO(_INPUT)

N, C = map(int, input().split())
P = [int(input()) for _ in range(N)]
Coupons1 = []
Coupons2 = []
for _ in range(C):
    t, x = map(int, input().split())
    if t == 1:
        Coupons1.append(x)
    else:
        Coupons2.append(x)
P.sort(reverse=True)
Coupons1.sort(reverse=True)
Coupons2.sort(reverse=True)
C1 = len(Coupons1)
C2 = len(Coupons2)

dp = [10**10] * (C1+1)
dp[0] = 0
for i in range(min(N, C)):
    for k in reversed(range(C1+1)):

        if k < C1:
            # Coupon1 を使う
            dp[k+1] = min(dp[k+1], dp[k] + max(P[i]-Coupons1[k], 0))

        if 0 <= i-k < C2:
            dp[k] = dp[k] + P[i] * (100-Coupons2[i-k])//100

if C < N:
    ans = min(dp) + sum(P[C:])
else:
    ans = min(dp)
print(ans)
0