Submission #874946

#TimeUsernameProblemLanguageResultExecution timeMemory
874946hugsfromadictoKnapsack (NOI18_knapsack)C++14
0 / 100
1 ms348 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN=2e5+5; bool dp[MAXN+1]; #define int long long signed main(){ int sum; cin>>sum; int t; dp[0]=true; while(cin>>t) { for(int i=sum;i>=t;i--) { if(dp[i-t]==true) { dp[i]=true; } } } for(int i=sum;i>=0;i--) { if(dp[i]==true) { cout<<i; return 0; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...