diff --git a/2022/21.cpp b/2022/21.cpp index cca346e..f2b4347 100644 --- a/2022/21.cpp +++ b/2022/21.cpp @@ -163,10 +163,12 @@ auto Part2(Input const& input) -> std::int64_t solver.add(constants.at(entry.lvalue) == rhs); } } + if (solver.check() != z3::sat) { throw std::runtime_error{"no solution to part 2"}; } - return solver.get_model().eval(constants.at("humn")).as_int64(); + + return solver.get_model().eval(constants.at("humn")).get_numeral_int64(); } } // namespace