File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ use aoc_runner_derive::aoc;
55const MAX : usize = 26 * 26 ;
66
77const T_START : u16 = ( b't' - b'a' ) as u16 * 26 ;
8- const T_END : u16 = T_START + 26 ;
98
109const T_START_REM : u16 = ( -( T_START as i16 ) ) . rem_euclid ( MAX as i16 ) as u16 ;
1110
@@ -34,6 +33,9 @@ pub fn part1(s: &str) -> u64 {
3433 i += 6 ;
3534 }
3635
36+ for c in connections. iter_mut ( ) {
37+ c. sort_unstable_by ( |a, b| b. cmp ( a) ) ;
38+ }
3739 // println!(
3840 // "{}{}:",
3941 // ((c / 26) as u8 + b'a') as char,
@@ -44,11 +46,11 @@ pub fn part1(s: &str) -> u64 {
4446 for c in 0 ..26 {
4547 for con in & connections[ c as usize ] {
4648 if * con < c {
47- continue ;
49+ break ;
4850 }
4951 for concon in & connections[ * con as usize ] {
5052 if * concon < * con {
51- continue ;
53+ break ;
5254 }
5355 for conconcon in & connections[ * concon as usize ] {
5456 if * conconcon == c {
You can’t perform that action at this time.
0 commit comments