27 lines
644 B
C++
27 lines
644 B
C++
#include <cstdint>
|
|
#include <string>
|
|
#include <iostream>
|
|
#include <vector>
|
|
|
|
#include <doctest.h>
|
|
|
|
#include <aocpp/Startup.hpp>
|
|
#include <aocpp/Parsing.hpp>
|
|
#include <knothash.hpp>
|
|
|
|
auto Main(std::istream & in, std::ostream & out) -> void
|
|
{
|
|
std::string line;
|
|
std::getline(in, line);
|
|
|
|
std::vector<std::uint8_t> lengths1;
|
|
for (auto && x : aocpp::SplitOn(line, ",")) {
|
|
lengths1.push_back(std::stoul(x));
|
|
}
|
|
|
|
auto result = knothash::hash_ex<256>(1, lengths1.begin(), lengths1.end());
|
|
out << "Part 1: " << long{result[0]} * long{result[1]} << std::endl;
|
|
|
|
out << "Part 2: " << knothash::render(knothash::hash(line)) << std::endl;
|
|
}
|