AlenAntonelli

III

Jun 20th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4.  
  5. #define ll long long
  6. #define a v[i].first
  7. #define b v[i].second
  8.  
  9. using namespace std;
  10.  
  11. int main ()
  12. {
  13.     int n;
  14.     cin >> n;
  15.    
  16.     vector< pair<ll,ll> >v (n);
  17.     for (int i=0; i<n; i++)
  18.         cin>>a>>b;
  19.     sort ( v.begin (), v.end() );
  20.    
  21.     ll t = 0;
  22.     for (int i=0; i<n; i++)
  23.     {
  24.         if (a > t)
  25.             t = a;
  26.         t += b;
  27.     }
  28.     cout << t << endl;
  29.    
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment