This repository has been archived on 2022-06-22. You can view files and clone it, but cannot push or open issues or pull requests.
usaco-guide/content/4_Silver/Binary_Search.md

34 lines
1.6 KiB
Markdown
Raw Normal View History

2020-06-04 01:42:57 +00:00
---
2020-06-15 23:19:07 +00:00
id: binary-search
2020-06-16 01:58:45 +00:00
title: "Binary Search on the Answer"
author: Darren Yao
2020-06-04 01:42:57 +00:00
---
2020-06-08 18:07:48 +00:00
## Binary Searching on the Answer
Oftentimes used when you need to find the minimum or maximum of some quantity such that it satisfies some property.
2020-06-07 07:38:45 +00:00
2020-06-08 18:07:48 +00:00
### Tutorial
2020-06-08 19:51:58 +00:00
2020-06-08 18:07:48 +00:00
- Intro to USACO 12.1
2020-06-05 23:02:56 +00:00
### Problems
2020-06-08 18:07:48 +00:00
2020-06-09 04:01:24 +00:00
- USACO
- [USACO Silver - Cow Dance](http://www.usaco.org/index.php?page=viewproblem2&cpid=690)
- binary search on $K$ and simulate
- [USACO Silver - Convention](http://www.usaco.org/index.php?page=viewproblem2&cpid=858)
- determine whether $M$ buses suffice if every cow waits at most $T$ minutes
- use a greedy strategy (applies to next two problems as well)
- [USACO Silver - Angry Cows](http://usaco.org/index.php?page=viewproblem2&cpid=594)
- check in $O(N)$ how many haybales you can destroy with fixed radius $R$
- [USACO Silver - Social Distancing](http://www.usaco.org/index.php?page=viewproblem2&cpid=1038)
- check in $O(N+M)$ how many cows you can place with distance $D$
- [USACO Silver - Loan Repayment](http://www.usaco.org/index.php?page=viewproblem2&cpid=991)
- requires some rather tricky analysis to speed up naive $O(N\log N)$ solution
- CF
- [The Meeting Place Cannot Be Changed](http://codeforces.com/contest/782/problem/B) [](48)
- [Preparing for Merge Sort](http://codeforces.com/contest/847/problem/B) [](53)
- [Level Generation](http://codeforces.com/problemset/problem/818/F) [](54)
- [Packmen](http://codeforces.com/contest/847/problem/E) [](57)
- [Office Keys](http://codeforces.com/problemset/problem/830/A) [](60)