#include <bits/stdc++.h>
#define int long long
using namespace std;
int n, x, y, a, b , maxn, ans , cnt1, cnt2;
signed main()
{
cin >> n >> x >> y >> a >> b;
for(int i = 1; i <= n; i ++)
{
int S, s, m;
cin >> S >> s >> m;
int tmp1 = S * x, tmp2 = s * y , val = m - tmp1 - tmp2;
if(val == 0)
{
cnt2 = 0;
cnt1 ++;
if(cnt1 >= b) ans /= 2;
}
else if(val > 0)
{
cnt1 = 0;
cnt2 ++;
if(val > tmp1 + tmp2) ans += ceil(0.5 * val);
ans += val;
if(cnt2 >= a) ans *= 2;
}
maxn = max(maxn, ans);
}
cout << maxn << " " << ans;
return 0;
}11
这是 2026年5月15日 存档的第 2 版,不是当前版本。查看当前版本