結果
| 問題 | 
                            No.1430 Coup de Coupon
                             | 
                    
| コンテスト | |
| ユーザー | 
                             burita083
                         | 
                    
| 提出日時 | 2021-03-14 15:35:24 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 971 bytes | 
| コンパイル時間 | 346 ms | 
| コンパイル使用メモリ | 12,800 KB | 
| 実行使用メモリ | 440,468 KB | 
| 最終ジャッジ日時 | 2024-11-06 05:27:33 | 
| 合計ジャッジ時間 | 4,038 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 6 TLE * 1 -- * 20 | 
ソースコード
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
T1 = []
T2 = []
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))
            
            
            
        
            
burita083