# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
960219 | RyaroX | Detecting Molecules (IOI16_molecules) | C++14 | 0 ms | 0 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;
typedef long long ll;
/*int[] find_subset(int l,int u,int[] w){
}*/
ll dp[20005];
int main()
{
//ifstream cin("in.in");
ll n,l,u;
cin>>n>>l>>u;
ll d=0;
dp[0]=1;
for(ll i=0;i<n;i++){
ll a;
cin>>a;
for(ll j=0;j<u;j++){
if(dp[j]>0){
dp[j+a]=a;
if(j+a>=l and j+a<=u){
ll s=j+a;
vector <ll> V;
while(s>0){
//cout<<s<<" "<<dp[s]<<"\n";
V.push_back(dp[s]);
s=s-dp[s];
}
reverse(V.begin(), V.end());
for(auto i:V) cout<<i<<" ";
return 0;
}
}
}
}
}