結果
| 問題 |
No.1715 Dinner 2
|
| コンテスト | |
| ユーザー |
taiga0629kyopro
|
| 提出日時 | 2021-10-22 22:12:25 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 540 bytes |
| コンパイル時間 | 182 ms |
| コンパイル使用メモリ | 81,900 KB |
| 実行使用メモリ | 76,496 KB |
| 最終ジャッジ日時 | 2024-09-23 05:46:08 |
| 合計ジャッジ時間 | 6,414 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 35 WA * 3 |
ソースコード
n,d=map(int,input().split())
p=[]
q=[]
for i in range(n):
a,b=map(int,input().split())
p.append(a)
q.append(b)
def f(x):
res=0
f=-1
for _ in range(d):
up=-10**18
ind=-1
for i in range(n):
if i!=f and res-p[i]>=x:
up=max(up,q[i]-p[i])
if up==q[i]-p[i]:ind=i
if up == -10 ** 18: return False
res+=up
f=ind
return True
ok=-10**18
ng=0
while ng-ok>1:
mid=(ok+ng)//2
if f(mid):ok=mid
else:ng=mid
print(ok)
taiga0629kyopro