文章
43
粉丝
180
获赞
21
访问
196.1k
#include <iostream>
using namespace std;
const int N = 1e5 + 10;
int n, m, a, b, k;
int p[N];
bool insert(int a, int b, int c)
{
for (int i = a; i <= b; i ++ ) if (p[i] + c > m) return false;
for (int i = a; i <= b; i ++ ) p[i] += c;
return true;
}
int main()
{
cin >> n >> m;
while (cin >> a >> b >> k)
if (insert(a, b, k)) puts("1");
else puts("0");
return 0;
}
登录后发布评论
暂无评论,来抢沙发