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;
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 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... |