性质 B 是代表活动之间不会冲突吗?
那我的骗分能骗到吗?
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define _DEBUG114514_
constexpr int MAXN = 100000;
int arr[MAXN+2];
bool vis[MAXN+2];
inline void fastio()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
int main()
{
int i,j,c,t;
int n,m,k,d;
int x,y,v;
ll ans = 0;
char op;
#ifndef _DEBUG114514_
freopen("run.in","r",stdin);
freopen("run.out","w",stdout);
#endif
fastio();
cin>>c>>t;
while(t--) {
cin>>n>>m>>k>>d;
for(i=0;i<m;i++) {
cin>>x>>y>>v;
if(x-y <= k && (x-y)*d < v) //天数不超限制,且收益大于付出
ans+=v-(x-y)*d;
}
}
cout<<ans<<endl;
#ifndef _DEBUG114514_
fclose(stdin);
fclose(stdout);
#endif
}