結果
問題 | No.817 Coin donation |
ユーザー |
![]() |
提出日時 | 2020-02-06 12:23:42 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 542 ms / 2,000 ms |
コード長 | 490 bytes |
コンパイル時間 | 150 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 47,416 KB |
最終ジャッジ日時 | 2024-09-25 06:42:21 |
合計ジャッジ時間 | 10,670 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 14 |
ソースコード
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np data = np.fromstring(read(), np.int64, sep=' ') N, K = data[:2] AB = data[2:] A = AB[::2] B = AB[1::2] def f(x): """count coins <= x""" return np.maximum(0, 1 + np.minimum(x, B) - A).sum() left = 0 right = 10 ** 9 while left + 1 < right: x = (left + right) // 2 if f(x) >= K: right = x else: left = x print(right)