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