結果

問題 No.1715 Dinner 2
ユーザー lloyzlloyz
提出日時 2021-11-10 23:12:37
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 319 bytes
コンパイル時間 76 ms
コンパイル使用メモリ 10,772 KB
実行使用メモリ 8,420 KB
最終ジャッジ日時 2023-08-13 22:12:25
合計ジャッジ時間 3,361 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,940 KB
testcase_01 AC 15 ms
7,832 KB
testcase_02 AC 15 ms
7,948 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 WA -
testcase_08 RE -
testcase_09 WA -
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 18 ms
8,316 KB
testcase_13 AC 18 ms
8,260 KB
testcase_14 AC 18 ms
8,232 KB
testcase_15 AC 19 ms
8,228 KB
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 WA -
testcase_33 AC 19 ms
8,284 KB
testcase_34 WA -
testcase_35 AC 19 ms
8,344 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

n, d = map(int, input().split())
L = []
for _ in range(n):
    p, q = map(int, input().split())
    L.append((p, q, -p + q))

L.sort(key=lambda x: (x[0], -x[2]))
ans = 10**10
curr = 0
for i in range(d):
    curr -= L[i][0]
    ans = min(ans, curr)
    curr += L[i][1]
    ans = min(ans, curr)
print(ans)
0