# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
239184 | 2020-06-14T17:41:23 Z | lakshith_ | Detecting Molecules (IOI16_molecules) | C++14 | 0 ms | 0 KB |
#include <bits/stdc++.h> using namespace std; int find_subset(int l, int u, int w[], int n, int result[]){ int m=0,sum=0; for(int i=0;i<n;i++) if(sum>=l&&sum<=u)break; else sum+=w[i]; if(sum>=l&&sum<=u){ m = sum/w[0]; for(int i=0;i<m;i++)result[i]=w[i]; return m; }else return 0; } // int main(){ // int w[] = {10,10,10,10}; // int result[4]; // int l,u; // // while(true){ // cin >> l >> u; // cout << find_subset(l,u,w,4,result) << "\n"; // } // }