From e9eb2eac2c52f968e0424f81941e06bdc9e14cca Mon Sep 17 00:00:00 2001 From: mid-kid Date: Fri, 9 Dec 2022 14:35:10 +0100 Subject: [PATCH] day 9 --- d09.cc | 108 +++ d09_input.txt | 2000 ++++++++++++++++++++++++++++++++++++++++++++++++ d09_output.txt | 2 + 3 files changed, 2110 insertions(+) create mode 100644 d09.cc create mode 100644 d09_input.txt create mode 100644 d09_output.txt diff --git a/d09.cc b/d09.cc new file mode 100644 index 0000000..aa97518 --- /dev/null +++ b/d09.cc @@ -0,0 +1,108 @@ +#include +#include +#include + +using namespace std; + +enum Dir { + UP, + DOWN, + RIGHT, + LEFT +}; + +struct Instr { + enum Dir dir; + unsigned steps; +}; + +struct Pos2d { + int x, y; + + Pos2d operator+(const Pos2d &r) const + { + return {this->x + r.x, this->y + r.y}; + } + void operator+=(const Pos2d &r) { *this = *this + r; } + + Pos2d operator-(const Pos2d &r) const + { + return {this->x - r.x, this->y - r.y}; + } + + bool operator==(const Pos2d &r) const + { + return this->x == r.x && this->y == r.y; + } +}; + +Pos2d dirs[] = { + {0, 1}, + {0, -1}, + {1, 0}, + {-1, 0} +}; + +typedef vector Input; + +template<> +struct std::hash { + size_t operator()(const Pos2d &r) const + { + return hash{}(r.x) ^ (hash{}(r.y) << 1); + } +}; + +Input parse() +{ + Input data; + for (string line; getline(cin, line);) { + Instr instr; + if (line.size() < 3 || line.at(1) != ' ') throw "parse"; + switch (line.at(0)) { + case 'U': instr.dir = UP; break; + case 'D': instr.dir = DOWN; break; + case 'L': instr.dir = LEFT; break; + case 'R': instr.dir = RIGHT; break; + } + instr.steps = stoi(line.substr(2)); + data.push_back(instr); + } + return data; +} + +unsigned p1(const Input &input, unsigned count = 2) +{ + auto knot = vector(count); + unordered_set visited; + visited.insert(knot.back()); + for (auto x : input) { + for (unsigned i = 0; i < x.steps; i++) { + knot.front() += dirs[x.dir]; + for (auto el = knot.begin(); el < knot.end() - 1; el++) { + Pos2d dist = el[0] - el[1]; + if (abs(dist.x) >= 2 || abs(dist.y) >= 2) { + if (abs(dist.x) >= 2) dist.x = dist.x > 0 ? 1 : -1; + if (abs(dist.y) >= 2) dist.y = dist.y > 0 ? 1 : -1; + el[1] += dist; + continue; + } + break; + } + visited.insert(knot.back()); + } + } + return visited.size(); +} + +unsigned p2(const Input &input) +{ + return p1(input, 10); +} + +int main() +{ + auto input = parse(); + cout << p1(input) << endl; + cout << p2(input) << endl; +} diff --git a/d09_input.txt b/d09_input.txt new file mode 100644 index 0000000..8ede1d7 --- /dev/null +++ b/d09_input.txt @@ -0,0 +1,2000 @@ +D 2 +R 2 +D 1 +U 1 +L 2 +U 2 +D 1 +R 2 +U 2 +R 2 +L 1 +D 2 +L 1 +U 1 +R 1 +D 1 +U 1 +R 1 +U 1 +R 1 +D 2 +L 1 +D 1 +L 1 +D 1 +U 1 +L 1 +R 1 +L 2 +D 1 +L 2 +R 1 +U 2 +L 2 +D 1 +U 2 +D 1 +L 1 +U 2 +L 2 +U 2 +D 2 +U 2 +D 2 +L 1 +D 2 +L 2 +D 2 +U 2 +L 2 +R 2 +U 1 +L 1 +D 2 +R 1 +D 2 +L 2 +R 1 +D 2 +R 1 +U 2 +L 2 +U 2 +D 1 +U 2 +L 2 +U 2 +L 1 +U 2 +L 1 +U 2 +D 1 +U 1 +D 2 +R 2 +L 1 +U 2 +L 1 +D 1 +R 2 +U 1 +L 1 +U 1 +R 2 +U 2 +D 2 +L 2 +U 2 +L 2 +R 1 +L 2 +U 1 +R 1 +L 1 +R 2 +U 1 +R 1 +D 1 +L 2 +R 2 +L 2 +R 1 +D 2 +R 1 +U 2 +L 2 +D 1 +R 2 +D 2 +L 2 +U 2 +D 2 +L 1 +D 2 +R 1 +L 3 +D 2 +R 1 +L 3 +R 2 +D 3 +U 3 +R 2 +L 1 +R 2 +U 2 +R 2 +L 1 +U 2 +D 1 +L 3 +U 3 +R 3 +D 2 +U 1 +L 2 +R 2 +D 1 +L 2 +U 3 +R 1 +L 3 +R 1 +L 3 +U 3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U 7 +R 7 +U 10 +L 5 +U 15 +L 2 +U 1 +D 6 +U 11 +L 13 +D 17 +R 13 +U 6 +R 12 +D 4 +L 15 +R 11 +U 14 +R 17 +D 18 +L 16 +D 9 +U 9 +R 8 +L 17 +U 9 +R 8 +D 5 +U 7 +L 5 +R 18 +L 17 +U 13 +L 14 +R 2 +D 15 +U 1 +R 10 +D 13 +R 14 +D 7 +U 13 +L 18 +U 6 +R 13 +U 16 +L 2 +R 1 +L 17 +R 9 +U 3 +R 7 +D 10 +L 3 +D 15 +L 13 +R 4 +D 16 +U 7 +D 6 +R 8 +U 3 +L 4 +U 14 +D 3 +L 17 +R 3 +L 18 +D 7 +L 1 +U 8 +D 1 +U 9 +L 17 +U 6 +L 5 +R 10 +L 18 +U 2 +D 18 +U 1 +D 13 +U 11 +R 9 +U 17 +D 14 +U 5 +R 3 +U 11 +D 1 +L 2 +R 5 +U 17 +R 12 +U 5 +D 4 +U 14 +D 6 +U 7 +L 18 +D 4 +R 17 +D 6 +U 8 +R 8 +L 5 +R 6 +L 4 +R 1 +U 9 +R 17 +U 11 +L 5 +R 17 +L 11 +D 9 +L 11 +D 16 +R 11 +D 17 +L 13 +D 11 +L 18 +R 13 +L 1 +D 19 +L 1 +U 15 +D 19 +U 13 +L 18 +U 19 +R 8 +U 9 +L 17 +R 6 +L 12 +R 19 +D 15 +R 15 +U 10 +D 3 +L 10 +D 18 +U 18 +R 6 +U 13 +R 6 +D 17 +R 12 +D 16 +R 3 +D 17 +U 12 +D 9 +R 6 +U 12 +L 10 +U 8 +D 4 +U 13 +R 1 +U 4 +L 11 +D 1 +U 13 +D 13 +L 12 +D 6 +U 18 +L 11 +D 16 +R 5 +D 2 +U 19 +R 12 +U 18 +L 5 +R 12 +L 3 +U 9 +R 13 +L 1 +U 10 +R 16 +L 6 +U 11 +L 3 +R 6 +U 5 +R 18 +U 8 +R 13 +D 19 +R 14 +U 14 +R 3 +D 18 +L 18 +U 5 +L 8 +U 13 +R 11 +U 12 +D 19 +L 10 +R 13 +D 18 +R 16 +L 14 +D 13 +U 2 +D 7 +U 3 +L 8 +R 15 +D 19 diff --git a/d09_output.txt b/d09_output.txt new file mode 100644 index 0000000..a1157a5 --- /dev/null +++ b/d09_output.txt @@ -0,0 +1,2 @@ +5930 +2443