day(05): add todo and comment out unused
Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
parent
715904ca2b
commit
0f5e11a79f
1 changed files with 9 additions and 7 deletions
|
@ -43,14 +43,14 @@ impl AlmanacRange {
|
||||||
Some(self.destination + (key - self.source))
|
Some(self.destination + (key - self.source))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn maps_to(&self) -> (i64, i64) {
|
// fn maps_to(&self) -> (i64, i64) {
|
||||||
(self.destination, self.destination + self.length)
|
// (self.destination, self.destination + self.length)
|
||||||
}
|
// }
|
||||||
|
|
||||||
fn overlaps(&self, start: i64, length: i64) -> bool {
|
// fn overlaps(&self, start: i64, length: i64) -> bool {
|
||||||
(start < self.source || self.has(start))
|
// (start < self.source || self.has(start))
|
||||||
&& (start + length >= self.upper_bound() || self.has(start + length))
|
// && (start + length >= self.upper_bound() || self.has(start + length))
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Mapping {
|
struct Mapping {
|
||||||
|
@ -102,6 +102,8 @@ impl Solution<Output1, Output2> for Day05 {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn part_2(&mut self) -> Output2 {
|
fn part_2(&mut self) -> Output2 {
|
||||||
|
// TODO: Optimize this part,
|
||||||
|
// even though it runs in 20s with rayon and release build
|
||||||
let indices = (0..self.seeds.len())
|
let indices = (0..self.seeds.len())
|
||||||
.map(|i| 2 * i)
|
.map(|i| 2 * i)
|
||||||
.take_while(|i| *i < self.seeds.len() - 1)
|
.take_while(|i| *i < self.seeds.len() - 1)
|
||||||
|
|
Loading…
Reference in a new issue