結果

問題 No.1430 Coup de Coupon
ユーザー burita083burita083
提出日時 2021-03-14 15:44:53
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 920 bytes
コンパイル時間 77 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 496,348 KB
最終ジャッジ日時 2024-04-23 23:16:10
合計ジャッジ時間 3,809 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 30 ms
10,752 KB
testcase_03 AC 49 ms
11,392 KB
testcase_04 AC 47 ms
11,904 KB
testcase_05 WA -
testcase_06 TLE -
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 = set()
qupons = set()
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 itemsId in items:
    continue
  if couponId in qupons:
    continue
  items.add(itemsId)
  qupons.add(couponId)
  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(ans)

0