aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaiwu <kaiwu2004@gmail.com>2023-01-19 11:20:06 +0800
committerkaiwu <kaiwu2004@gmail.com>2023-01-19 11:20:06 +0800
commit83ffcfdb072324d68fe8d8b474b8d90822b9acb8 (patch)
tree31380b811c8b3506c16544cf3b7cfcb677ef568a
parentdeb6771f642d8f64fba26e334f3b80cb865db652 (diff)
downloadadvent-of-code-83ffcfdb072324d68fe8d8b474b8d90822b9acb8.tar.gz
advent-of-code-83ffcfdb072324d68fe8d8b474b8d90822b9acb8.zip
2015 day24 dfs needs prune branches
-rw-r--r--src/2015/day24/aoc.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/2015/day24/aoc.cpp b/src/2015/day24/aoc.cpp
index b92f8ee..bd456fd 100644
--- a/src/2015/day24/aoc.cpp
+++ b/src/2015/day24/aoc.cpp
@@ -32,9 +32,6 @@ void find(int x, std::set<int> selected, const std::vector<int>& ns, int target,
qes.insert(quantum_entanglement(selected));
}
} else {
- if (*min != INT32_MAX && selected.size() > *min)
- return;
-
for (size_t i = 0; i < ns.size(); i++) {
auto n = ns[i];
if (n + x <= target && selected.find(n) == selected.end()) {
@@ -59,7 +56,7 @@ std::pair<int, int> day24(line_view file) {
std::set<int> selected;
std::set<int64_t> qes;
size_t min{INT32_MAX};
- printf("total is %d\n", total);
+ // printf("total is %d\n", total);
find(0, selected, ns, total / 3, &min, qes);
for (auto& qe : qes) {