Cod sursa(job #2345798)

Utilizator sygAndreiIonitaIonita Andrei sygAndreiIonita Data 16 februarie 2019 18:02:56
Problema Orase Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.31 kb
#include <fstream>

using namespace std;

ifstream in ("orase.in");
ofstream out ("orase.out");

int main()
{
    int n,m,max1=0,max2=0,l,d;
    in>>n>>m;
    for (int i=1;i<=m;i++)
    {
      in>>l>>d;
      max1=max(max1,l+d);
      max2=max(max2,d-l);
    }
    out<<max1+max2;
    return 0;
}