Cod sursa(job #1170165)

Utilizator BarracudaFMI-Alex Dobrin Barracuda Data 12 aprilie 2014 19:41:19
Problema Stergeri Scor 100
Compilator cpp Status done
Runda Teme Pregatire ACM Unibuc 2013 Semestrul 2 Marime 0.48 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;
}