結果
| 問題 |
No.817 Coin donation
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-11-09 10:01:02 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 525 ms / 2,000 ms |
| コード長 | 406 bytes |
| コンパイル時間 | 263 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 24,064 KB |
| 最終ジャッジ日時 | 2024-09-15 04:13:58 |
| 合計ジャッジ時間 | 4,278 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 14 |
ソースコード
N, K = map(int, input().split())
coins = []
for _ in range(N):
A, B = map(int, input().split())
coins.append((A, B + 1))
def isOk(m):
cnt = 0
for a, b in coins:
if a >= m:
continue
cnt += min(m, b) - a
return cnt < K
ok = 0
ng = 10**9 + 1
while ng - ok > 1:
mid = (ok + ng) // 2
if isOk(mid):
ok = mid
else:
ng = mid
print(ok)