結果
| 問題 |
No.817 Coin donation
|
| コンテスト | |
| ユーザー |
brthyyjp
|
| 提出日時 | 2021-05-25 22:51:50 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 165 ms / 2,000 ms |
| コード長 | 485 bytes |
| コンパイル時間 | 271 ms |
| コンパイル使用メモリ | 82,184 KB |
| 実行使用メモリ | 81,204 KB |
| 最終ジャッジ日時 | 2024-10-14 13:45:22 |
| 合計ジャッジ時間 | 3,045 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 14 |
ソースコード
n, k = map(int, input().split())
AB = []
for i in range(n):
a, b = map(int, input().split())
AB.append((a, b))
def is_ok(x):
cnt = 0
for a, b in AB:
if x < a:
continue
elif a <= x <= b:
cnt += x-a+1
else:
cnt += b-a+1
if cnt >= k:
return True
else:
return False
ng = 0
ok = 10**9+1
while ng+1<ok:
c = (ng+ok)//2
if is_ok(c):
ok = c
else:
ng = c
print(ok)
brthyyjp