結果

問題 No.1430 Coup de Coupon
ユーザー so4649so4649
提出日時 2021-03-14 14:48:40
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,083 bytes
コンパイル時間 234 ms
コンパイル使用メモリ 81,908 KB
実行使用メモリ 77,980 KB
最終ジャッジ日時 2024-04-23 22:28:59
合計ジャッジ時間 5,912 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
51,840 KB
testcase_01 AC 41 ms
52,224 KB
testcase_02 AC 41 ms
51,840 KB
testcase_03 AC 71 ms
67,840 KB
testcase_04 AC 76 ms
70,144 KB
testcase_05 AC 74 ms
70,016 KB
testcase_06 AC 109 ms
76,380 KB
testcase_07 AC 106 ms
76,672 KB
testcase_08 AC 279 ms
76,800 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 216 ms
77,824 KB
testcase_21 AC 101 ms
76,416 KB
testcase_22 AC 43 ms
52,736 KB
testcase_23 AC 45 ms
53,376 KB
testcase_24 WA -
testcase_25 AC 81 ms
70,656 KB
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n,c = map(int,input().split())
p = [int(input()) for i in range(n)]
p.sort(reverse=True)
hiki = []
wari = []
for i in range(c):
    t,x = map(int,input().split())
    if t == 1:
        hiki.append(x)
    else:
        wari.append(x)
wari.sort(reverse=True)
hiki.sort(reverse=True)

ans = sum(p)
for a in range(min(n,len(wari))+1):
    b = min(n-a,len(hiki))
    count = sum(p)
    # 引きがb枚、割がa枚
    wari_now = 0
    hiki_now = 0
    for i in range(n):
        if wari_now == a and hiki_now == b:
            continue
        if wari_now == a:
            count -= min(p[i],hiki[hiki_now])
            hiki_now += 1
        elif hiki_now == b:
            count -= p[i]//100*wari[wari_now]
            wari_now += 1
        else:
            if p[i]//100*wari[wari_now]+min(p[i+1],hiki[hiki_now]) >= min(p[i],hiki[hiki_now])+p[i+1]//100*wari[wari_now]:
                count -= p[i]//100*wari[wari_now]
                wari_now += 1
            else:
                count -= min(p[i],hiki[hiki_now])
                hiki_now += 1
    ans = min(ans,count)

print(ans)
0