BZOJ1047B Cover Points

原题链接:http://codeforces.com/contest/1047/problem/B

Cover Points

There are n n n points on the plane, ( x 1 , y 1 ) , ( x 2 , y 2 ) , ⋯   , ( x n , y n ) (x_1,y_1),(x_2,y_2),\cdots,(x_n,y_n) (x1,y1),(x2,y2),,(xn,yn).

You need to place an isosceles triangle with two sides on the coordinate axis to cover all points (a point is covered if it lies inside the triangle or on the side of the triangle). Calculate the minimum length of the shorter side of the triangle.

Input

First line contains one integer n ( 1 ≤ n ≤ 1 0 5 ) n (1≤n≤10^5) n(1n105).

Each of the next n n n lines contains two integers x i x_i xi and y i ( 1 ≤ x i , y i ≤ 1 0 9 ) y_i (1≤x_i,y_i≤10^9) yi(1xi,yi109).

Output

Print the minimum length of the shorter side of the triangle. It can be proved that it’s always an integer.

Examples
input

3
1 1
1 2
2 1

output

3

input

4
1 1
1 2
2 1
2 2

output

4

Note

Illustration for the first example:

Illustration for the second example:

题解

算算每个点对应的等腰直角三角形的大小,取个 m a x max max即可。

代码
#include<bits/stdc++.h>
using namespace std;
int n,ans;
void in(){scanf("%d",&n);}
void ac()
{
	for(int i=1,a,b;i<=n;++i)
	scanf("%d%d",&a,&b),ans=max(ans,a+b);
	printf("%d",ans);
}
int main(){in();ac();}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ShadyPi

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值