結果

問題 No.1430 Coup de Coupon
ユーザー netyo715netyo715
提出日時 2021-03-14 14:20:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 611 bytes
コンパイル時間 110 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-04-23 21:50:23
合計ジャッジ時間 2,469 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,752 KB
testcase_01 AC 26 ms
10,752 KB
testcase_02 AC 26 ms
10,752 KB
testcase_03 AC 36 ms
10,880 KB
testcase_04 AC 40 ms
10,880 KB
testcase_05 AC 42 ms
10,880 KB
testcase_06 AC 61 ms
11,136 KB
testcase_07 AC 63 ms
11,136 KB
testcase_08 AC 60 ms
11,008 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 WA -
testcase_19 WA -
testcase_20 AC 50 ms
11,008 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 26 ms
10,752 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N, C = map(int, input().split())
INF = float("inf")
P = [int(input()) for _ in range(N)]
P.sort(reverse=True)
T1 = []
T2 = []
for _ in range(C):
    t, x = map(int, input().split())
    if t  == 1:
        T1.append(x)
    else:
        T2.append(x)
T1.sort()
T2.sort()
ans = 0
for p in P:
    if T1:
        t1 = max(p-T1[-1], 0)
    else:
        t1 = INF
    if T2:
        t2 = p*(100-T2[-1])//100
    else:
        t2 = INF
    if t1 == t2 == INF:
        ans += p
    else:
        if t2 <= t1:
            ans += t2
            T2.pop()
        else:
            ans += t1
            T1.pop()
print(ans)
0