Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main()
- {
- long long s,n;
- pair<int,int>m[n];
- cin>>s>>n;
- for(int i=0;i<n;i++)
- cin>>m[i].first>>m[i].second;
- sort(m,m+n);
- for(auto &m : m){
- if(s>m.first)s+=m.second;
- else {
- cout<<"NO";
- return 0;
- }
- }
- cout<<"YES";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment