This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
const ll MAXN = 1e5 + 5;
const ll MAXT = 2e3 + 5;
ll n, t, li, ei, ki, dp[MAXT];
void update(ll a, ll b) {
// {Spread, Energi}
for (int i = t; i >= 0; --i)
{
if (i < b)
{
break;
}
dp[i] = max(dp[i], dp[i-b] + a);
}
}
int main(){
cin >> t >> n;
for (int i = 0; i < n; ++i)
{
cin >> li >> ei >> ki;
ki = min(ki, t / ei);
while(ki--) {
update(li, ei);
}
}
cout << dp[t] << "\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |