Cod sursa(job #2251876)
| Utilizator | Data | 2 octombrie 2018 08:27:37 | |
|---|---|---|---|
| Problema | Orase | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.42 kb |
#include <bits/stdc++.h>
#define Dim 50004
using namespace std;
ifstream f("orase.in");
ofstream g("orase.out");
long N,M;
long ans;
pair < long,long> V[Dim];
int main()
{
f>>M>>N;
for(int i=1;i<=N;i++)
f>>V[i].first>>V[i].second;
sort(V+1,V+N+1);
for(int i=1;i<=N;i++)
for(int j=i-1;j>=1;j--)
ans=max(ans,V[i].second+V[j].second+V[i].first-V[i].second);
g<<ans;
return 0;
}
