# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
730620 | PVSekhar | Knapsack (NOI18_knapsack) | C++14 | 124 ms | 5320 KiB |
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;
#define ll long long
const ll MOD = 1000000007;
int main()
{
ll n,s;
cin>>s>>n;
vector<ll> dp(s+1,0);
vector<vector<pair<ll,ll>>> store(s+1);
ll v,w,k;
for (ll i = 0; i < n; i++)
{
cin>>v>>w>>k;
store[w].push_back({v,k});
}
for (auto &st:store)
{
sort(st.begin(),st.end());
reverse(st.begin(),st.end());
}
vector<pair<ll,ll>> final_store;
ll ind=0,x=0;
for (ll i = 1; i <= s; i++)
{
ind=0;
for (ll j = 0; j <= (s/i); j++)
{
Compilation message (stderr)
# | 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... |