Reformat day 3

This commit is contained in:
Nick Krichevsky 2020-12-03 00:32:02 -05:00
parent ed1c1037af
commit 5b41f34883

View file

@ -42,12 +42,16 @@ int part1(const std::vector<std::string> &input) {
long part2(const std::vector<std::string> &input) { long part2(const std::vector<std::string> &input) {
// deltas in the x and y directions respectively // deltas in the x and y directions respectively
std::vector<std::pair<int, int>> deltas{std::pair<int, int>(1, 1), std::pair<int, int>(3, 1), std::vector<std::pair<int, int>> deltas{
std::pair<int, int>(5, 1), std::pair<int, int>(7, 1), std::pair<int, int>(1, 1),
std::pair<int, int>(1, 2)}; std::pair<int, int>(3, 1),
std::pair<int, int>(5, 1),
std::pair<int, int>(7, 1),
std::pair<int, int>(1, 2),
};
return std::reduce(std::execution::par, deltas.begin(), deltas.end(), 1L, return std::reduce(
[&](long total, std::pair<int, int> step_deltas) { std::execution::par, deltas.begin(), deltas.end(), 1L, [&](long total, std::pair<int, int> step_deltas) {
return total * findNumTrees(input, step_deltas.first, step_deltas.second); return total * findNumTrees(input, step_deltas.first, step_deltas.second);
}); });
} }