aboutsummaryrefslogtreecommitdiff
path: root/src/2016/day11/aoc.h
diff options
context:
space:
mode:
authorkaiwu <kaiwu2004@gmail.com>2023-01-20 11:38:52 +0800
committerkaiwu <kaiwu2004@gmail.com>2023-01-20 11:38:52 +0800
commit957d0f9f9b0c8c8c6889e496e807e178ae1a10da (patch)
treed30d3f7545604e48b9356a3b91fbfc3a3255c7c5 /src/2016/day11/aoc.h
parent6596c0c0ecdc79a13a29a89d1c5528c52c0b52a2 (diff)
downloadadvent-of-code-957d0f9f9b0c8c8c6889e496e807e178ae1a10da.tar.gz
advent-of-code-957d0f9f9b0c8c8c6889e496e807e178ae1a10da.zip
2016 day11 model
Diffstat (limited to 'src/2016/day11/aoc.h')
-rw-r--r--src/2016/day11/aoc.h49
1 files changed, 48 insertions, 1 deletions
diff --git a/src/2016/day11/aoc.h b/src/2016/day11/aoc.h
index 67f350c..5c89c3e 100644
--- a/src/2016/day11/aoc.h
+++ b/src/2016/day11/aoc.h
@@ -2,6 +2,53 @@
#include "common.h"
#include <vector>
+// F4 . . . . . . . . . . .
+// F3 . . . . . . . HG HM RG RM
+// F2 . . . . PM . SM . . . .
+// F1 E TG TM PG . SG . . . . .
+//
+// F4 . . . . .
+// F3 . . . LG .
+// F2 . HG . . .
+// F1 E . HM . LM
+//
+// 0.
+// take everythong to the forth floor
+//
+// 1.
+// there is an elevator that can move between the four floors.
+// When you enter the containment area, you and the elevator will start on the first floor.
+//
+// 2.
+// Its capacity rating means it can carry at most yourself and two RTGs or microchips in any combination.
+//
+// 3.
+// As a security measure, the elevator will only function if it contains at least one RTG or microchip.
+//
+// 4.
+// The elevator always stops on each floor to recharge,
+// Each elevator stop counts as one step, even if nothing is added to or removed from it
+//
+// 5.
+// if a chip is ever left in the same area as another RTG,
+// and it's not connected to its own RTG, the chip will be fried.
+//
+
namespace aoc2016 {
+
+enum rtype {
+ gen,
+ chip,
+};
+
+struct ritem {
+ rtype t;
+ int id;
+
+ friend bool operator<(ritem r1, ritem r2) { return r1.id < r2.id ? true : r1.id > r2.id ? false : r1.t < r2.t; }
+ bool match(ritem r) const noexcept { return id == r.id && t != r.t; }
+ bool fried_with(ritem r) const noexcept { return id != r.id && t != r.t; }
+};
+
std::pair<int64_t, int64_t> day11(line_view);
-}
+} // namespace aoc2016