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. 抓包工具fiddler安装和配置

    常见的抓包工具:fiddler.wireshark,本文以安装fiddler为例: 在官网上https://www.telerik.com/fiddler下载,安装后打开fiddler. 选择好自己的 ...

  2. 31.2 try finally使用

    package day31_exception; import java.io.FileWriter; import java.io.IOException; import java.lang.Exc ...

  3. logger日志级别

    Level 描述 ALL 各级包括自定义级别 DEBUG 指定细粒度信息事件是最有用的应用程序调试 ERROR 错误事件可能仍然允许应用程序继续运行 FATAL 指定非常严重的错误事件,这可能导致应用 ...

  4. java集合中的一个移除数据陷阱(遍历集合自身并同时删除被遍历数据)

    下面是网上的其他解释,更能从本质上解释原因:Iterator 是工作在一个独立的线程中,并且拥有一个 mutex 锁. Iterator 被创建之后会建立一个指向原来对象的单链索引表,当原来的对象数量 ...

  5. AJ学IOS(05)UI之360等下载管理器九宫格UI

    AJ分享,必须精品 先看效果 主要是完成了九宫格UI的搭建 代码 - (void)viewDidLoad { [super viewDidLoad]; //九宫格中每个格子的宽 #define kAp ...

  6. 使用malloc和free函数进行内存动态分配

    一.在学习c语言里面,内存分配这个话题非常有意思,因为我们平时在开发的时候,如果一不小心没注意内存释放的话,写的的程序很容易出错,所以今天就来回顾一下c语言里面的内存动态分配,下面我们先来看一个实例来 ...

  7. Linux 下发送邮件

    由于种种原因,需要由我这个兼职运维每天发送对账单文件给运营同学,故研究下 Linux 发送邮件,希望对大家有所帮助. 安装 # Centos,安装 mailx $ yum install -y mai ...

  8. jQuery+ajax实现滚动到页面底部自动加载图文列表效果

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  9. Word文档创建目录

    一.以设置两级目录为例: 1.设置两个标题,标题1对应第一级目录,标题2对应第二级目录. 点击标题1,点击修改: 设置好样式和格式: 同理设置标题2. 2.创建多级目录: 选择级别1,关联到标题1,设 ...

  10. Python变量详解

    Python变量详解 目录 Python变量详解 一.变量的定义 二.变量组成的三部分 2.1 变量名 2.1.1 变量名的命名规范 2.1.2 变量名的命名风格 2.2 赋值符号 2.3 变量值 三 ...