Oh no, I've been affected by the bug in Day 6. My solution was correct, but the adventofcode.com didn't recognise it. I tested some of the solutions posted here and they gave the same output as mine. I'm not sure how to progress to Part 2, so only posting Part 1:
#!/usr/bin/perlusewarnings;usestrict;usefeatureqw{ say };useList::Utilqw{ max };my%locations;my$location='A';my($X,$Y)=(0,0);while(<>){chomp;my($x,$y)=split/,\s+/;$locations{$location++}=[$x,$y];$X=$xif$x>$X;$Y=$yif$y>$Y;}my@nearest;formy$x(0..$X+1){formy$y(0..$Y+1){my@n=(abs($locations{A}[0]-$x)+abs($locations{A}[1]-$y),'A');formy$location(keys%locations){nextif'A'eq$location;my$distance=abs($locations{$location}[0]-$x)+abs($locations{$location}[1]-$y);if($distance<=$n[0]){@n=($distance)if$distance<$n[0];push@n,$location;}}$nearest[$x][$y]=\@n;}}my%freq;++$freq{$_->[1]}forgrep@$_==2,map @$_, @nearest;delete@freq{map $_->[1], grep @$_ == 2, $nearest[0],$nearest[-1],map($_->[0], @nearest),map($_->[-1], @nearest)};saymax(0, values%freq);
re: AoC Day 6: Chronal Coordinates VIEW POST
FULL DISCUSSIONOh no, I've been affected by the bug in Day 6. My solution was correct, but the adventofcode.com didn't recognise it. I tested some of the solutions posted here and they gave the same output as mine. I'm not sure how to progress to Part 2, so only posting Part 1:
Oh no! Thatβs a bummer π