Compare commits

..

No commits in common. "aaf9b54e038ce3f9b395e69399cc49daeac94a4b" and "f16918d137ce3e020e11838f960733502dbf7263" have entirely different histories.

View File

@ -76,11 +76,13 @@ void insert_or_increment(std::map<size_t, uint64_t> &cols, size_t col,
uint64_t part_2(const Grid &grid) {
Location start = find_start(grid);
const auto [start_row, start_col]{start};
using namespace std::ranges::views;
using namespace std::ranges;
auto view = iota_view{start_row, grid.size()};
std::map<size_t, uint64_t> starting_cols{{start_col, 1}};
auto cols = fold_left(view, starting_cols, [&grid](auto cols, auto row) {
return fold_left(cols, std::map<size_t, uint64_t>{},
auto cols = fold_left(view, starting_cols, [&grid](auto acc, auto row) {
return fold_left(acc, std::map<size_t, uint64_t>{},
[&grid, &row](auto next_cols, auto col_cnt) {
auto [col, cnt] = col_cnt;
if (at_loc(grid, row, col) == '^') {