aboutsummaryrefslogtreecommitdiff
path: root/src/2017/day13/aoc.cpp
blob: bab68251024c0bdeab878196bbca9a5dc4aca79c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "aoc.h"

namespace aoc2017 {

std::pair<int64_t, int64_t> day13(line_view file) {
  std::vector<scanner> vs;
  per_line(file, [&vs](line_view lv) {
    vs.emplace_back(lv);
    return true;
  });

  int severity{0};
  for (auto& s : vs) {
    if (s.at_level(s.depth) == 0) {
      // s.print();
      severity += s.depth * s.range;
    }
  }

  // for (auto& s: vs) {
  //   s.print();
  // }
  return {severity, 0};
}
} // namespace aoc2017