| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1329501 | scalifrastico_098 | Knapsack (NOI18_knapsack) | C++20 | 307 ms | 444 KiB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main ()
{
ll w, n; cin>>w>>n; vector<ll> dp(w+1, 0);
for(ll i=0; i<n; i++)
{
ll v, y, k; cin>>v>>y>>k;
for(ll j=w; j>=0; j--)
{
for(ll o=1; o<=k; o++)
{
if(j+o*y>w)break;
if(dp[j]+o*v>dp[j+o*y])dp[j+o*y]=max(dp[j+o*y], dp[j]+o*v);
else break;
}
}
}
ll u=0; for(ll i=0; i<=w; i++)u=max(u, dp[i]); cout<<u<<endl;
}| # | 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... | ||||
