# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
448435 | _DaNeK_ | Detecting Molecules (IOI16_molecules) | C++17 | 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.
int find_subset(int l, int u, int w[], int n, int result[])
{
int s = l;
ll cursum = 0;
l = 0;
int r = 0;
sort (w, w + n);
while (l < n)
{
while (r < n && cursum < s)
{
cursum += w[r];
++r;
}
if (cursum >= s && cursum <= s)
{
for (int i = 0; i < r - l; ++i)
result[i] = w[l + i];
return 1;
}
cursum -= a[l];
++l;
}
return 0;
}