Cod sursa(job #1950265)

Utilizator GoogalAbabei Daniel Googal Data 2 aprilie 2017 20:56:10
Problema Orase Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.39 kb
#include <fstream>

using namespace std;

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

int const INF = -100000000;

int n, m, ms, md;

int main()
{
  int a, b;
  ms = md = INF;
  in >> n >> m;
  for(int i = 1; i <= m; i++){
    in >> a >> b;
    ms = max(ms, a + b);
    md = max(md, b - a);
  }

  out << ms + md;

  in.close();
  out.close();
  return 0;
}