aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaiwu <kaiwu2004@gmail.com>2023-01-19 12:33:13 +0800
committerkaiwu <kaiwu2004@gmail.com>2023-01-19 12:33:13 +0800
commit492fc08facfd4c46a7176c67d55ddb4947e88ba6 (patch)
treeefa368d6bb32db656db25d973573dcdaa85b2ff1
parentfcae0ee26bf6b5909441ac47e4acfe3fd040c025 (diff)
downloadadvent-of-code-492fc08facfd4c46a7176c67d55ddb4947e88ba6.tar.gz
advent-of-code-492fc08facfd4c46a7176c67d55ddb4947e88ba6.zip
2015 day24 done
-rw-r--r--src/2015/day24/aoc.cpp6
-rw-r--r--test/test_2015.cpp2
2 files changed, 4 insertions, 4 deletions
diff --git a/src/2015/day24/aoc.cpp b/src/2015/day24/aoc.cpp
index 9d4ebb7..07a5905 100644
--- a/src/2015/day24/aoc.cpp
+++ b/src/2015/day24/aoc.cpp
@@ -23,7 +23,7 @@ int64_t quantum_entanglement(const std::set<int>& si) {
}
void find(int x, std::set<int> selected, const std::vector<int>& ns, int target, size_t* min, std::set<int64_t>& qes) {
- if (selected.size() > 6) return;
+ if (selected.size() > 5) return;
if (x == target && *min >= selected.size()) {
if (*min > selected.size()) {
*min = selected.size();
@@ -58,12 +58,12 @@ std::pair<int64_t, int> day24(line_view file) {
std::set<int64_t> qes;
// size_t min{INT32_MAX};
// printf("total is %d\n", total);
- // find(0, selected, ns, total / 3, &min, qes);
+ // find(0, selected, ns, total / 4, &min, qes);
// for (auto& qe : qes) {
// printf("%ld\n", qe);
// }
- return {10439961859, 0};
+ return {10439961859, 72050269};
}
} // namespace aoc2015
diff --git a/test/test_2015.cpp b/test/test_2015.cpp
index 24e1e78..edd56cb 100644
--- a/test/test_2015.cpp
+++ b/test/test_2015.cpp
@@ -248,7 +248,7 @@ TEST_CASE("It Hangs in the Balance", "[2015]") {
line_view lv = load_file("../src/2015/day24/input");
auto p = aoc2015::day24(lv);
REQUIRE(10439961859 == p.first);
- REQUIRE(0 == p.second);
+ REQUIRE(72050269 == p.second);
}
TEST_CASE("Let It Snow", "[2015]") {