Cod sursa(job #843568)
Utilizator | FMI-Alex Dobrin Barracuda | Data | 28 decembrie 2012 01:17:32 |
---|---|---|---|
Problema | Stergeri | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.49 kb |
#include <fstream>
#define dim 100005
#define LL long long
using namespace std;
ifstream f("stergeri.in");
ofstream g("stergeri.out");
struct cut{
LL low, high;
};
cut x[dim];
LL N, M, K,sol;
int main(){
f>>N>>M>>K;
sol=K;
for (LL i=M;i>=1;--i){
f>>x[i].low>>x[i].high;
}
for (LL i=1; i <= M; ++ i)
if (sol>=x[i].low){
sol+=x[i].high-x[i].low;
++ sol;
}
g<<sol;
return 0;
}