結果

問題 No.1430 Coup de Coupon
ユーザー aaaaaaaaaa2230
提出日時 2021-03-14 14:16:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 576 bytes
コンパイル時間 198 ms
コンパイル使用メモリ 82,324 KB
実行使用メモリ 77,256 KB
最終ジャッジ日時 2024-11-06 04:01:21
合計ジャッジ時間 3,263 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

n,c = map(int,input().split())
P = [int(input()) for i in range(n)]
l = [[] for i in range(2)]
for i in range(c):
    t,x = map(int,input().split())
    if t == 1:
        l[0].append(x)
    else:
        l[1].append(x)

P.sort(reverse=True)
l[0].sort(reverse=True)
l[1].sort(reverse=True)

ans = sum(P)
n0 = 0
n1 = 0
for p in P:
    dis1 = 0
    dis2 = 0
    if n0 < len(l[0]):
        dis1 = min(l[0][n0],p)
    if n1 < len(l[1]):
        dis2 = p*l[1][n1]//100
    if dis1 > dis2:
        ans -= dis1
        n0 += 1
    else:
        ans -= dis2
        n1 += 1
print(ans)
0