Cod sursa(job #2559396)

Utilizator geo_uwuManolachi George geo_uwu Data 27 februarie 2020 12:02:42
Problema Orase Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.46 kb
#include <bits/stdc++.h>
using namespace std;
ifstream f("orase.in");
ofstream g("orase.out");
//vector<long int> v;
int n,m,distanta,lungime,top_max,bot_max;
long int dist_max;
int main()
{
    f>>n>>m;
    for(int i=1;i<=m;++i)
    {
        f>>distanta>>lungime;
        if(distanta>(n+1)/2) top_max=max(top_max,(distanta-n)+lungime);
        if(distanta<(n+1)/2) bot_max=max(bot_max,lungime-distanta);

    }
    g<<bot_max+top_max+n;
    return 0;
}