aboutsummaryrefslogtreecommitdiff
path: root/src/2022/day4/aoc.cpp
blob: 0ba53e2fd24cbfb073ac45bcdf89065a7d547bd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "aoc.h"
#include <algorithm>
#include <vector>

namespace aoc2022 {
std::pair<int, int> day4(line_view file) {
  int c1{0}, c2{0};
  per_line(file, [&c1, &c2](line_view lv){
      apair p;
      p.load(lv);
      c1 += (int) p.covered();
      c2 += (int) p.overlap();
      return true;
  });
  return {c1, c2};
}

} // namespace aoc2022