結果
| 問題 | No.817 Coin donation |
| コンテスト | |
| ユーザー |
brthyyjp
|
| 提出日時 | 2021-05-25 22:51:50 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 114 ms / 2,000 ms |
| コード長 | 485 bytes |
| 記録 | |
| コンパイル時間 | 1,747 ms |
| コンパイル使用メモリ | 85,376 KB |
| 実行使用メモリ | 86,096 KB |
| 最終ジャッジ日時 | 2026-05-02 00:00:06 |
| 合計ジャッジ時間 | 3,312 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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