Reformat day 3
This commit is contained in:
parent
ed1c1037af
commit
5b41f34883
|
@ -42,14 +42,18 @@ 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);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
|
Loading…
Reference in a new issue