题解 CF1047B 【Cover Points】

STLGirlfriend

2018-09-24 11:04:15

Solution

可转换为求函数 $y = -x + b$ 使该函数图像可以覆盖所有点的 $b$ 值。 移项可得 $b = x + y$,所以求 $\max\{x_i + y_i\}$ 即为答案。 ```c++ #include <cstdio> #include <algorithm> const int MaxN = 1e5; int main() { int n; scanf("%d", &n); int res = -1e9; for (int i = 1; i <= n; ++i) { int x, y; scanf("%d %d", &x, &y); res = std::max(res, x + y); } printf("%d\n", res); } ```