Cod sursa(job #2334770)

Utilizator Dragne.Andrei11Dragne Andrei Dragne.Andrei11 Data 3 februarie 2019 00:37:12
Problema Orase Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.43 kb
#include <bits/stdc++.h>

using namespace std;

int main()
{
    freopen("orase.in", "r", stdin);
    freopen("orase.out", "w", stdout);
    int m, n, rasp=0;

    scanf("%d%d", &m, &n);
    int max1, max2;
    max1=max2=0;
    for(int i=1;i<=n;i++)
    {
        int x, y;
        scanf("%d%d", &x, &y);
        max1=max(max1, x+y);
        max2=max(max2, y-x);
    }
    printf("%d\n", max1+max2);

    return 0;
}