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;
const int max_n = 100000;
vector<int> find_subset(int l, int u, vector<int> w)
{
int n = w.size();
unordered_map<ll, bitset<max_n>> subsets;
subsets[0] = bitset<max_n>(0);
for (int i = 0; i < n; i++)
{
vector<pair<ll, bitset<max_n>>> new_subsets;
for (auto [sum, subset] : subsets)
{
subset[i] = 1;
if (sum + w[i] <= u)
new_subsets.push_back({sum + w[i], subset});
}
for (auto [sum, subset] : new_subsets)
{
subsets[sum] = subset;
if (l <= sum)
{
vector<int> res;
for (int j = 0; j <= i; j++)
if (subset[j])
res.push_back(j);
return res;
}
}
}
return vector<int>(0,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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |