結果

問題 No.1430 Coup de Coupon
コンテスト
ユーザー flippergo
提出日時 2026-07-13 09:12:31
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 775 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 272 ms
コンパイル使用メモリ 96,492 KB
実行使用メモリ 86,316 KB
最終ジャッジ日時 2026-07-13 09:12:38
合計ジャッジ時間 4,953 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N,C = map(int,input().split())
P = sorted([int(input()) for _ in range(N)])
T1 = []
T2 = []
for _ in range(C):
    t,x = map(int,input().split())
    if t==1:
        T1.append(x)
    else:
        T2.append(x)
T1 = sorted(T1)
T2 = sorted(T2)
ans = 0
for i in range(N):
    p = P.pop()
    flag = 2
    ind = -1
    dmax = 0
    for j in range(len(T2)):
        if dmax<min(p,p//100*T2[j]):
            dmax = min(p,p//100*T2[j])
            ind = j
    for j in range(len(T1)):
        if dmax<min(p,T1[j]):
            dmax = min(p,T1[j])
            ind = j
            flag = 1
    if flag==2 and ind>=0:
        t2 = T2.pop(ind)
        ans += max(0,p-p//100*t2)
    elif flag==1:
        t1 = T1.pop(ind)
        ans += max(0,p-t1)
    else:
        ans += p
print(ans)
0