Fuck it we ball
This commit is contained in:
		
							parent
							
								
									e215cd7472
								
							
						
					
					
						commit
						b49467a59e
					
				| @ -131,11 +131,9 @@ impl NumButton { | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| type Input = String; | ||||
| 
 | ||||
| #[aoc_generator(day21)] | ||||
| fn parse(input: &str) -> Input { | ||||
|     input.to_string() | ||||
| fn parse(input: &str) -> &'static str { | ||||
|     unsafe { std::mem::transmute(input) } | ||||
| } | ||||
| 
 | ||||
| type Path = [DistanceSize; 6]; | ||||
| @ -336,7 +334,7 @@ const CHAR_IDX: [usize; 10] = [ | ||||
| ]; | ||||
| 
 | ||||
| #[aoc(day21, part1)] | ||||
| fn part1(input: &Input) -> DistanceSize { | ||||
| fn part1(input: &str) -> DistanceSize { | ||||
|     let num_paths = const { | ||||
|         let steps = precompute_steps_new::<2>([[1; 5]; 5]); | ||||
|         let paths = precompute_paths(); | ||||
| @ -358,7 +356,7 @@ fn part1(input: &Input) -> DistanceSize { | ||||
| } | ||||
| 
 | ||||
| #[aoc(day21, part2)] | ||||
| fn part2(input: &Input) -> DistanceSize { | ||||
| fn part2(input: &str) -> DistanceSize { | ||||
|     let num_paths = const { | ||||
|         let steps = precompute_steps_new::<25>([[1; 5]; 5]); | ||||
|         let paths = precompute_paths(); | ||||
| @ -385,10 +383,10 @@ mod tests { | ||||
| 
 | ||||
|     #[test] | ||||
|     fn part1_example() { | ||||
|         assert_eq!(part1(&parse("379A")), 64 * 379); | ||||
|         assert_eq!(part1(&parse("179A")), 68 * 179); | ||||
|         assert_eq!(part1(&parse("456A")), 64 * 456); | ||||
|         assert_eq!(part1(&parse("980A")), 60 * 980); | ||||
|         assert_eq!(part1(&parse("029A")), 68 * 29); | ||||
|         assert_eq!(part1(parse("379A")), 64 * 379); | ||||
|         assert_eq!(part1(parse("179A")), 68 * 179); | ||||
|         assert_eq!(part1(parse("456A")), 64 * 456); | ||||
|         assert_eq!(part1(parse("980A")), 60 * 980); | ||||
|         assert_eq!(part1(parse("029A")), 68 * 29); | ||||
|     } | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Jan-Bulthuis
						Jan-Bulthuis