@@ -13,7 +13,7 @@ fn parse(input: &str) -> Result<(Vec<String>, Vec<String>), AocError> {
13
13
Ok ( ( towels, designs) )
14
14
}
15
15
16
- fn count_possible ( towels : & [ String ] , design : & str , cache : & mut HashMap < String , usize > ) -> usize {
16
+ fn count_possible ( towels : & [ String ] , design : & str , cache : & mut HashMap < String , u64 > ) -> u64 {
17
17
if design. is_empty ( ) {
18
18
return 1 ;
19
19
}
@@ -35,26 +35,26 @@ fn count_possible(towels: &[String], design: &str, cache: &mut HashMap<String, u
35
35
36
36
pub struct Day19 ;
37
37
impl Solution for Day19 {
38
- type A = usize ;
39
- type B = usize ;
38
+ type A = u64 ;
39
+ type B = u64 ;
40
40
41
41
fn default_input ( & self ) -> & ' static str {
42
42
include_str ! ( "../../../inputs/2024/day19.txt" )
43
43
}
44
44
45
- fn part_1 ( & self , input : & str ) -> Result < usize , AocError > {
45
+ fn part_1 ( & self , input : & str ) -> Result < u64 , AocError > {
46
46
let ( towels, designs) = parse ( input) ?;
47
47
48
48
let mut cache = HashMap :: new ( ) ;
49
49
let possible = designs
50
50
. iter ( )
51
51
. filter ( |design| count_possible ( & towels, design, & mut cache) > 0 )
52
- . count ( ) ;
52
+ . count ( ) as u64 ;
53
53
54
54
Ok ( possible)
55
55
}
56
56
57
- fn part_2 ( & self , input : & str ) -> Result < usize , AocError > {
57
+ fn part_2 ( & self , input : & str ) -> Result < u64 , AocError > {
58
58
let ( towels, designs) = parse ( input) ?;
59
59
60
60
let mut cache = HashMap :: new ( ) ;
0 commit comments