結果

問題 No.1715 Dinner 2
ユーザー yamasaKit_yamasaKit_
提出日時 2022-02-12 22:29:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 474 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 10,932 KB
実行使用メモリ 8,840 KB
最終ジャッジ日時 2023-09-11 11:01:51
合計ジャッジ時間 3,325 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,560 KB
testcase_01 AC 19 ms
8,564 KB
testcase_02 AC 19 ms
8,488 KB
testcase_03 AC 19 ms
8,488 KB
testcase_04 AC 19 ms
8,624 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 23 ms
8,708 KB
testcase_13 AC 22 ms
8,652 KB
testcase_14 AC 22 ms
8,604 KB
testcase_15 AC 23 ms
8,764 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 19 ms
8,492 KB
testcase_21 AC 18 ms
8,488 KB
testcase_22 WA -
testcase_23 AC 19 ms
8,588 KB
testcase_24 WA -
testcase_25 AC 19 ms
8,496 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 19 ms
8,488 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 18 ms
8,580 KB
testcase_32 WA -
testcase_33 AC 23 ms
8,724 KB
testcase_34 WA -
testcase_35 AC 23 ms
8,760 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
from itertools import *
import sys


def debug(*args, end="\n"):
    print(*args, end=end, file=sys.stderr)


sys.setrecursionlimit(10 ** 6)
MOD = 998244353

N, D = map(int, input().split())
menus = []
for _ in range(N):
    p, q = map(int, input().split())
    menus.append((p, q))

menus = sorted(menus, key=lambda x: (x[0], -x[1]))
ans = 0
cur = 0
for p, q in menus[:D]:
    cur -= p
    ans = min(ans, cur)
    cur += q
print(ans)
debug("ans")
0