Pagini recente » Cod sursa (job #1792139) | Cod sursa (job #1808286) | Cod sursa (job #2196914) | Cod sursa (job #2829728) | Cod sursa (job #843568)
Cod sursa(job #843568)
#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;
}