結果

問題 No.1430 Coup de Coupon
ユーザー burita083burita083
提出日時 2021-03-14 15:38:31
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 955 bytes
コンパイル時間 292 ms
コンパイル使用メモリ 82,288 KB
実行使用メモリ 849,384 KB
最終ジャッジ日時 2024-04-23 23:10:17
合計ジャッジ時間 4,078 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,436 KB
testcase_01 AC 39 ms
52,124 KB
testcase_02 AC 39 ms
53,428 KB
testcase_03 AC 73 ms
72,672 KB
testcase_04 AC 81 ms
77,056 KB
testcase_05 AC 79 ms
77,312 KB
testcase_06 MLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N, C = map(int, input().split())
P = []
for i in range(N):
  p = int(input())
  P.append(p)

TX = [tuple(map(int,input().split())) for i in range(C)]

ans = 0
items = [False] * N
qupons = [False] * C
l = []
for idx, p in enumerate(P):
  for i, (t, x) in enumerate(TX):
    if t == 1:
      l.append((idx, i,  min(x, p)))
    else:
      l.append((idx, i, p-p*(100-x)//100))


buys = []
l.sort(key=lambda x:(-x[2]))
for itemsId, couponId, v in l:
  if items[itemsId] == True:
    continue
  if qupons[couponId] == True:
    continue
  items[itemsId] = True
  qupons[couponId] = True
  buys.append((itemsId, couponId))
for i, p in enumerate(P):
  flag = False
  for itemsId, couponId in buys:
    if itemsId == i:
      flag = True
      if TX[couponId][0] == 1:
        ans += max(p-TX[couponId][1], 0)
        break
      else:
        rate = (100-TX[couponId][1])/100
        ans += p*rate
        break
  if flag == False:
    ans += p
print(int(ans))

0