blob: 3ea54324f2e21455fb83d5f49e9e8d59c7c73f53 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#include "aoc.h"
namespace aoc2018 {
std::pair<int, int> day3(line_view file, int x) {
fabric* f = new fabric;
std::vector<claim> cs;
per_line(file, [&f, &cs](line_view lv) {
f->parse(lv, cs);
return true;
});
int id{0};
for (auto& c : cs) {
if (!f->overlap(c)) {
id = c.id;
}
}
return {f->count(x), id};
}
} // namespace aoc2018
|