diff options
| -rw-r--r-- | 2016/src/day06.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/2016/src/day06.cpp b/2016/src/day06.cpp index 5bd0f93..32bf9cc 100644 --- a/2016/src/day06.cpp +++ b/2016/src/day06.cpp | |||
| @@ -36,8 +36,10 @@ solve(const vector<string>& lines) | |||
| 36 | ++counts[line[col]]; | 36 | ++counts[line[col]]; |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | part1 += max_element(counts.begin(), counts.end(), [](auto lhs, auto rhs) { return lhs.second < rhs.second; })->first; | 39 | const auto [min, max] = ranges::minmax_element(counts, [](auto lhs, auto rhs) { return lhs.second < rhs.second; }); |
| 40 | part2 += min_element(counts.begin(), counts.end(), [](auto lhs, auto rhs) { return lhs.second < rhs.second; })->first; | 40 | |
| 41 | part1 += max->first; | ||
| 42 | part2 += min->first; | ||
| 41 | } | 43 | } |
| 42 | 44 | ||
| 43 | cout << part1 << '\n' | 45 | cout << part1 << '\n' |
