結果

問題 No.1430 Coup de Coupon
ユーザー 小野寺健小野寺健
提出日時 2021-05-19 18:03:52
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 609 bytes
コンパイル時間 162 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,264 KB
最終ジャッジ日時 2024-04-18 04:45:38
合計ジャッジ時間 2,677 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,752 KB
testcase_01 AC 31 ms
10,752 KB
testcase_02 AC 31 ms
10,752 KB
testcase_03 AC 44 ms
11,008 KB
testcase_04 AC 41 ms
10,880 KB
testcase_05 AC 43 ms
10,880 KB
testcase_06 AC 61 ms
11,136 KB
testcase_07 AC 65 ms
11,136 KB
testcase_08 AC 64 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 56 ms
11,008 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 29 ms
10,752 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N, C = map(int, input().split())

P = []
for _ in range(N):
    P.append(int(input()))
    
P.sort(reverse=True)

TY = []
TP = []
for _ in range(C):
    T, X = map(int, input().split())
    if T == 1:
        TY.append(X)
    else:
        TP.append(X)
TY.sort(reverse=True)
TP.sort(reverse=True)

Total = 0
for price in P:
    if len(TP) == 0:
        dc = TY.pop(0) if len(TY) > 0  else 0
    elif len(TY) == 0:
        dc = (TP.pop(0) * price // 100)
    elif TY[0] > TP[0] * price // 100:
        dc = TY.pop(0)
    else:
        dc = (TP.pop(0) * price // 100)
    Total += max(price-dc, 0)

print(Total)
0