結果
| 問題 |
No.2957 Combo Deck Builder
|
| コンテスト | |
| ユーザー |
ニックネーム
|
| 提出日時 | 2024-11-08 22:48:22 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 714 ms / 1,000 ms |
| コード長 | 343 bytes |
| コンパイル時間 | 238 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 105,372 KB |
| 最終ジャッジ日時 | 2024-11-08 22:48:51 |
| 合計ジャッジ時間 | 21,728 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 38 |
ソースコード
from heapq import heappop,heappush
n = int(input())
a = []; b = []; s = 0
for _ in range(n):
c,x,y = map(int,input().split()); s += max(x,y)
if x<y: a.append((c,y-x))
if x>y: b.append((n-c,x-y))
def f(a):
global s; h = []
for c,d in sorted(a):
heappush(h,d)
if len(h)>c: s -= heappop(h)
f(a); f(b); print(s)
ニックネーム