Codeforces Round #511 (Div. 2).B. Cover Points

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/XxxxxM1/article/details/82810978

B. Cover Points

time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

There are nn points on the plane, (x1,y1),(x2,y2),…,(xn,yn)(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 nn (1≤n≤1051≤n≤105).

Each of the next nn lines contains two integers xixi and yiyi (1≤xi,yi≤1091≤xi,yi≤109).

Output

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

Examples

input

Copy

3
1 1
1 2
2 1

output

Copy

3

input

Copy

4
1 1
1 2
2 1
2 2

output

Copy

4

Note

Illustration for the first example:

Illustration for the second example:

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define M(a) memset(a,0,sizeof(a))
#define maxn 200010

int main()
{
    int t;
    ll x,y;
    while(cin>>t)
    {
        long long maxx=-1;
        for(int i=0;i<t;i++){
            cin>>x>>y;
            if(x+y>maxx) maxx=x+y;
        }
        cout<<maxx<<endl;
    }
    return 0;
}

猜你喜欢

转载自blog.csdn.net/XxxxxM1/article/details/82810978