# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
528952 | juankipedia | Knapsack (NOI18_knapsack) | C++14 | 86 ms | 5072 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 endl "\n"
# define io_boost std::ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
typedef unsigned long long int ulli;
typedef long long int lli;
/*************************************JUANKIPEDIA*************************************/
const lli oo = INT32_MIN;
const int MAXN = 100005;
lli N, S;
int main(){
io_boost;
cin >> S >> N;
map<lli, vector<pair<lli, lli>>> items;
for(lli i = 0; i < N; i++){
lli V, W, K;
cin >> V >> W >> K;
if(W <= S) items[W].push_back({V, K});
}
vector<lli> dp(S + 5, 0);
int idx = 1;
for(auto &[w, v] : items){
sort(v.begin(), v.end(), greater<pair<lli, lli>>());
vector<lli> DP;
DP = dp;
for(lli i = 0; i <= S; i++){
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... |