Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int i,N,t,a,b,bbest,abest=0;
- cin>>N;
- cin>>t;
- bbest=t;
- for (i=0;i<N;i++) {
- cin>>a>>b;
- bbest=min(bbest+b,abest+a+t);
- abest+=a;
- }
- cout<<bbest;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement