B. Cover Points

time limit per test1 second

memory limit per test256 megabytes

inputstandard input

outputstandard output

There are n points on the plane, (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≤105).

Each of the next n lines contains two integers xi and yi (1≤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

inputCopy

3

1 1

1 2

2 1

outputCopy

3

inputCopy

4

1 1

1 2

2 1

2 2

outputCopy

4

Note

Illustration for the first example:



Illustration for the second example:



题意是找一个三角形把所有点都覆盖,求等腰三角形最短边长。额他的长度因为是等腰直角三角型,很奇怪,最大的X+Y正好是最短边长。

#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,a,b,max2=0;
cin>>n;
while(n--)
{
scanf("%d %d",&a,&b);
max2=max(a+b,max2);
}
cout<<max2<<endl;
return 0;
}

CodeForces - 1047B Cover Points的更多相关文章

  1. B. Cover Points Codeforces Round #511 (Div. 2)【数学】

    题目: There are nn points on the plane, (x1,y1),(x2,y2),…,(xn,yn)(x1,y1),(x2,y2),…,(xn,yn). You need t ...

  2. codeforces 19D D. Points 树套树

    D. Points Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/19/problem/D De ...

  3. codeforces B.Fixed Points

    link:http://codeforces.com/contest/347/problem/B 很简单,最多只能交换一次,也就是说,最多会增加两个.可能会增加一个.也可能一个也不增加(此时都是fix ...

  4. codeforces 577E E. Points on Plane(构造+分块)

    题目链接: E. Points on Plane time limit per test 2 seconds memory limit per test 256 megabytes input sta ...

  5. codeforces B. Fixed Points 解题报告

    题目链接:http://codeforces.com/problemset/problem/347/B 题目意思:给出一个包含n个数的排列a,在排列a中最多只能作一次交换,使得ai = i 这样的匹配 ...

  6. codeforces 19 D. Points(线段树+set二分)

    题目链接:http://codeforces.com/contest/19/problem/D 题意:给出3种操作:1)添加点(x,y),2)删除点(x,y),3)查询离(x,y)最近的右上方的点. ...

  7. Codeforces C Match Points(二分贪心)

    题目描述: Match Points time limit per test 2 seconds memory limit per test 256 mega bytes input standard ...

  8. Codeforces 871C 872E Points, Lines and Ready-made Titles

    题 OvO http://codeforces.com/contest/871/problem/C ( Codeforces Round #440 (Div. 1, based on Technocu ...

  9. CodeForces 1000C Covered Points Count(区间线段覆盖问题,差分)

    https://codeforces.com/problemset/problem/1000/C 题意: 有n个线段,覆盖[li,ri],最后依次输出覆盖层数为1~n的点的个数. 思路: 区间线段覆盖 ...

随机推荐

  1. 《操作系统》课程笔记(Ch01-导论)

    Ch01 - 导论 操作系统的功能 用户视角:在乎使用方便,不在乎资源利用 系统视角:资源分配器.控制程序 计算机系统的运行 启动:利用固件(Firmware)中的引导程序(Bootstrap Pro ...

  2. Go golang语言特性

    一.垃圾回收 1.内存自动回收. 2.只需要创建,不需要释放 二.天然并发: 1.语言层支持并发,对比python,少了GIL锁. 2.goroute,轻量级线程. 3.基于CSP模型实现 三.cha ...

  3. MySQL入门,第六部分,关系代数

    关系代数是一种集合操作为基础过程化查询语言,特点:运算对象是关系,运算结果亦为关系 一.关系代数的特点 运算对象:关系 运算结果:关系 运算符:四类 集合运算符 专门的关系运算符 算术比较符 逻辑运算 ...

  4. spark sql createOrReplaceTempView registerTempTable

    createOrReplaceTempView2.x版本以上. registerTempTable1.5.x val data1 = dataSelect1(sqlContext, sparkMode ...

  5. python3(三十三)debug

    """ 调试 """ __author__on__ = 'shaozhiqi 2019/9/23' # 调试程序 # . print打印,没 ...

  6. Vue + d3.js实现在地图上选点

    需求:用户在地图上单击选点,页面获取到具体坐标并返回. 首先比较重要的是Vue中的$nextTick,因为vue是异步更新的,如果是想打开Dialog或者是其他操作dom后才加载地图,使用nextTi ...

  7. jmeter5.1.1 生成html报告

    1.首先需要准备好 .jmx 脚本 2.修改jmeter.properties文件(把注解去掉,报告中才能展示所需信息) jmeter.save.saveservice.output_format=x ...

  8. [javascript]各种页面定时跳转(倒计时跳转)代码总结

    (1)使用setTimeout函数实现定时跳转(如下代码要写在body区域内) <script type="text/javascript"> //3秒钟之后跳转到指定 ...

  9. javascript: Object对象生成URL参数

    code: function makeQuery(queryObject) { const query = Object.entries(queryObject) .reduce((result, e ...

  10. Java IO 流 -- 转换流: InputStreamReader OutputStreamWriter

    java 中 转换流是以字符流的形式操作字节流,需要注意一下两点: 1.操作内容必须是纯文本 2.指定字符集避免乱码 操作控制台输入输出: try (BufferedReader br = new B ...