| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1362925 | shreyas_arun | Knapsack (NOI18_knapsack) | C++20 | 0 ms | 344 KiB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct hw
{
ll val, w, k;
};
void solve()
{
ll s, n;
cin >> s >> n;
vector<hw> v(n);
for (auto &i : v)
{
cin >> i.val >> i.w >> i.k;
}
if (n == 1)
{
if (v[0].w > s)
{
cout << 0 << '\n';
return;
}
ll cal = s / v[0].w;
if (cal >= v[0].k)
{
cout << v[0].val * v[0].k << '\n';
}
else if (cal < v[0].k)
{
cout << v[0].val * cal << '\n';
}
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
solve();
return 0;
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
