結果

問題 No.1430 Coup de Coupon
ユーザー aqua_tenhouaqua_tenhou
提出日時 2021-03-14 14:34:19
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 816 bytes
コンパイル時間 153 ms
コンパイル使用メモリ 82,236 KB
実行使用メモリ 77,416 KB
最終ジャッジ日時 2024-04-23 22:01:12
合計ジャッジ時間 2,873 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
52,464 KB
testcase_01 AC 37 ms
52,560 KB
testcase_02 AC 37 ms
53,416 KB
testcase_03 AC 58 ms
68,464 KB
testcase_04 AC 67 ms
74,676 KB
testcase_05 AC 63 ms
74,388 KB
testcase_06 AC 84 ms
76,880 KB
testcase_07 AC 90 ms
76,848 KB
testcase_08 AC 95 ms
76,728 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 89 ms
77,228 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 37 ms
54,872 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n,c = map(int,input().split())
p = [int(input()) for i in range(n)]
z = [list(map(int,input().split())) for i in range(c)]

t1 = []
t2 = []
for t,x in z:
    if t == 1:
        t1.append(x)
    else:
        t2.append(x)

t1 = sorted(t1,reverse=True)
t2 = sorted(t2,reverse=True)
p = sorted(p,reverse=True)

ans = 0
j = 0
k = 0
for x in p:
    if j < len(t1) and k < len(t2):
        s1 = max(0, x-t1[j])
        s2 = x*(100-t2[k])//100
        if s1 < s2:
            ans += s1
            j += 1
            
        else:
            ans += s2
            k += 1
            
    elif j < len(t1):
        s1 = max(0, x-t1[j])
        ans += s1
        j += 1
        
    elif k < len(t2):
        s2 = x*(100-t2[k])//100
        ans += s2
        k += 1
        
    else:
        ans += x
        
print(ans)

0