Submission #655037

#TimeUsernameProblemLanguageResultExecution timeMemory
655037benjaminkleynDetecting Molecules (IOI16_molecules)C++17
31 / 100
734 ms65536 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...