fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. const int MaxN=2e5;
  5. const int MaxT=2e5;
  6. long add[MaxT+1]={};
  7.  
  8. int main() {
  9. int N,W,S,T,P;
  10. cin>>N>>W;
  11. for(int n=0; n<N;n++){
  12. cin>>S>>T>>P;
  13. add[S]+=P;
  14. add[T]-=P;
  15. }
  16. long now=0;
  17. for(int t=0;t<=MaxT;t++){
  18. now+=add[t];
  19. if(now>W){
  20. cout<<"No";
  21. return 0;
  22. }
  23. }
  24. cout<<"Yes";
  25. return 0;
  26. }
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
Yes