#include<iostream>
#include<cmath>
using namespace std;
int jd[105], N, M, sum = 1e9;
struct lx1
{
int s, t, c;
} cow[25];
struct lx2
{
int a, b, p, m;
bool flag = 0;
} air[15];
void gcd(int step)
{
if (step > N)
{
int sum1 = 0;
for (int i = 1; i <= N; i++)
{
for (int j = cow[i].s; j <= cow[i].t; j++)
{
if (cow[i].c > jd[i]) return ;
}
}
for (int i = 1; i <= M; i++)
{
if (air[i].flag)
{
sum1 += air[i].m;
}
}
cout << sum1 << endl;
sum = min(sum, sum1);
return ;
}
air[step].flag = 0;
gcd(step + 1);
air[step].flag = 1;
for (int i = air[step].a; i <= air[step].b; i++)
{
jd[i] += air[step].p;
}
gcd(step + 1);
}
int main()
{
cin >> N >> M;
for(int i = 1; i <= N; i++)
{
cin >> cow[i].s >> cow[i].t >> cow[i].c;
}
for(int i = 1; i <= M; i++)
{
cin >> air[i].a >> air[i].b >> air[i].p >> air[i].m;
}
gcd(1);
cout << sum;
return 0;
}
暴力枚举,0蛋,问问各位大佬咋回事?