#include <bits/stdc++.h>
using namespace std;
#define int long long
const int NUM = 1e7;
int diff[NUM] = { 0 };
signed main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int N, W;
cin >> N >> W;
int tmin = 0x3f3f3f3f;
int tmax = 0;
for (int i = 1; i <= N; i++) {
int s, t, p;
tmin = min(s, tmin);
tmax = max(t, tmax);
cin >> s >> t >> p;
diff[s] += p;
diff[t] -= p;
}
bool ans = true;
for (int i = tmin; i <= tmax; i++) {
diff[i] += diff[i - 1];
if (diff[i] > W)ans = false;
}
if (ans)cout << "Yes" << '\n';
else cout << "No" << '\n';
return 0;
}
lanqiao 3898
最新推荐文章于 2024-07-13 19:27:27 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)