結果

問題 No.1715 Dinner 2
ユーザー Shirotsume
提出日時 2021-10-22 21:41:59
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 259 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 82,180 KB
実行使用メモリ 64,292 KB
最終ジャッジ日時 2024-09-23 05:01:30
合計ジャッジ時間 2,944 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 32 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

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

pq.sort(reverse = True)
ans = 0
now = 0
for i in range(d):
    now += pq[i % 2][0]
    ans = min(ans,now)
    now += pq[i % 2][1]
print(ans)
0