Pagini recente » Cod sursa (job #1137683) | Cod sursa (job #809986) | Cod sursa (job #1815102) | Cod sursa (job #705291) | Cod sursa (job #2209668)
#include <fstream>
#include <cmath>
#include <iostream>
using namespace std;
ifstream fin("orase.in");
ofstream fout("orase.out");
struct Punct
{
int d;
int l;
};
int distBetw(Punct& A, Punct& B)
{
///DE NU UITAT CAZUL IN CARE AU ACEEASI DISTANTA FARA DE CAPATUL STRAZII
return A.l+B.l+abs(A.d-B.d);
}
Punct puncte[50010];
int M,N,best;
int main()
{
fin>>M>>N;
for (int i=1;i<=N;i++)
fin>>puncte[i].d>>puncte[i].l;
for (int i=1;i<=N;i++)
for (int j=i+1;j<=N;j++)
if (best<distBetw(puncte[i],puncte[j])) best = distBetw(puncte[i],puncte[j]);
fout<<best;
return 0;
}