Pagini recente » Cod sursa (job #2402607) | Cod sursa (job #908449) | Cod sursa (job #2552612) | Cod sursa (job #531207) | Cod sursa (job #2554954)
#include <bits/stdc++.h>
using namespace std;
ifstream in("orase.in");
ofstream out("orase.out");
int M,N;
int main()
{
in>>M>>N;
vector<pair<int,int>> r(M);
int ipm = 0, dmax = -1;
for(int i = 0; i < M; ++i)
{
int x, y;in>>x>>y;
r[i] = make_pair(x,y);
if(x+y>dmax)
{
dmax = x+y;
ipm = i;
}
}
for(int i = 0; i < M; ++i)
{
dmax = max(dmax,r[i].second + abs(r[i].first - r[ipm].first) + r[ipm].second);
}
out<<dmax;
return 0;
}