Cod sursa(job #2151747)

Utilizator ivddabDabelea Ioana-Viviana ivddab Data 4 martie 2018 21:05:31
Problema Orase Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.35 kb
#include <fstream>
#include <algorithm>
using namespace std;
ifstream f("orase.in");
ofstream g("orase.out");
int m,n,i,d1,l1,max1,max2;
int main()
{
    f>>m>>n; max1=0; max2=0;
    for(i=1;i<=n;i++){
        f>>d1>>l1;
        if(max1<l1-d1) max1=l1-d1;
        if(max2<l1+d1) max2=l1+d1;
    }
    g<<max1+max2<<'\n';
    return 0;
}