+11
-10
src/04/solution.cxx
+11
-10
src/04/solution.cxx
···
1
+
#include <cstddef>
1
2
#include <filesystem>
2
3
#include <fstream>
3
4
#include <print>
···
17
18
}
18
19
};
19
20
20
-
unsigned long width() { return data[0].length(); }
21
+
std::size_t width() { return data[0].length(); }
21
22
22
-
unsigned long height() { return data.size(); }
23
+
std::size_t height() { return data.size(); }
23
24
24
-
std::string &operator[](unsigned long idx) { return data[idx]; }
25
+
std::string &operator[](std::size_t idx) { return data[idx]; }
25
26
26
-
const std::string &operator[](unsigned long idx) const { return data[idx]; }
27
+
const std::string &operator[](std::size_t idx) const { return data[idx]; }
27
28
28
-
std::string get_surrounding(unsigned long row, unsigned long col) {
29
+
std::string get_surrounding(std::size_t row, std::size_t col) {
29
30
std::string sur = "";
30
31
sur.resize(8);
31
-
unsigned long wid = width();
32
+
std::size_t wid = width();
32
33
auto hi = height();
33
34
34
35
if (row > 0 && col > 0) {
···
64
65
};
65
66
66
67
struct Roll {
67
-
unsigned long row;
68
-
unsigned long col;
68
+
std::size_t row;
69
+
std::size_t col;
69
70
};
70
71
71
72
std::vector<Roll> get_removable_rolls(Matrix &data) {
72
73
std::vector<Roll> rolls{};
73
-
for (unsigned long row = 0; row < data.height(); ++row) {
74
-
for (unsigned long col = 0; col < data.width(); ++col) {
74
+
for (std::size_t row = 0; row < data.height(); ++row) {
75
+
for (std::size_t col = 0; col < data.width(); ++col) {
75
76
if (data[row][col] != '@') {
76
77
continue;
77
78
}