Pagini recente » Cod sursa (job #365359) | Cod sursa (job #887667) | Cod sursa (job #2627162) | Cod sursa (job #659454) | Cod sursa (job #3184171)
/*
* Lefter Sergiu - 14/12/2023
*/
#include <fstream>
using namespace std;
ifstream in("orase.in");
ofstream out("orase.out");
const int INF = 2e9;
int main() {
int n, m, maxi1 = -INF, maxi2 = -INF;
in >> m >> n;
for (int i = 1; i <= n; ++i) {
int x, y;
in >> x >> y;
int distantaVerticala = x + y;
int distantaPeStradaPrincipala = x - y;
maxi1 = max(maxi1, distantaVerticala);
maxi2 = max(maxi2, distantaPeStradaPrincipala);
}
out << maxi1 + maxi2;
in.close();
out.close();
return 0;
}