AoC code coverage
Current view: top level - puzzles/2025 - Day09.cpp (source / functions) Coverage Total Hit
Test: master Lines: 100.0 % 20 20
Test Date: 2026-05-24 23:46:10 Functions: 100.0 % 4 4

            Line data    Source code
       1              : #include "LinewiseInput.h"
       2              : #include "PuzzleImpl.h"
       3              : 
       4              : #include "Parsing.h"
       5              : #include "Vector.h"
       6              : #include "Views.h"
       7              : 
       8              : #include <algorithm>
       9              : #include <string_view>
      10              : #include <vector>
      11              : 
      12              : namespace {
      13              : 
      14              : using Coord = Vector<2, int64_t>;
      15              : 
      16            1 : std::vector<Coord> parseInput(std::string_view const input) {
      17          496 :   return input | views::splitLines | views::transform([](auto const &line) {
      18          496 :            Coord c;
      19          496 :            parseIntegerRange<int64_t>(line, c);
      20          496 :            return c;
      21          496 :          }) |
      22            1 :          std::ranges::to<std::vector<Coord>>();
      23            1 : }
      24              : 
      25              : } // namespace
      26              : 
      27            1 : template <> std::string solvePart1<2025, 9>(std::string_view const input) {
      28            1 :   std::vector<Coord> coords = parseInput(input);
      29            1 :   int64_t maxArea = 0;
      30          497 :   for (auto it = coords.begin(); it != coords.end(); ++it) {
      31       123256 :     for (auto jt = std::next(it); jt != coords.end(); ++jt) {
      32       122760 :       int64_t const area = (std::abs(it->x() - jt->x()) + 1) * (std::abs(it->y() - jt->y()) + 1);
      33       122760 :       maxArea = std::max(maxArea, area);
      34       122760 :     }
      35          496 :   }
      36              : 
      37            1 :   return std::to_string(maxArea);
      38            1 : }
      39              : 
      40            1 : template <> std::string solvePart2<2025, 9>(std::string_view const /* input */) { return {}; }
        

Generated by: LCOV version 2.4-0