CARVIEW |
Select Language
HTTP/2 200
date: Sat, 11 Oct 2025 06:14:05 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=fcd11bc6425fdd4803b4fe9044aacd6a5184a3a2d6e32ec4644a310453a5eabaa%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22A8B918AV51cHAjnwbK8Yjab87GjRMpSi%22%3B%7D; HttpOnly; Path=/
cf-ray: 98cc371bcd6b5917-BLR
AoC 2024, day 14, part 1 (Perl) - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use warnings;
- use feature qw(say);
- use List::Util qw(product all);
- my @DIM = (101, 103);
- $; = ',';
- my @robots = map { [m#([-0-9]+,[-0-9]+)#g] } <>;
- my %moved;
- foreach my $robot (@robots) {
- my ($pos, $vel) = map {[split /,/]} @$robot;
- @$pos = map { ($pos->[$_] + 100 * $vel->[$_]) % $DIM[$_] } (0,1);
- $moved{ $pos->[0], $pos->[1] }++;
- }
- my %quads;
- foreach my $robot (keys %moved) {
- my @pos = split( $;, $robot );
- my @quad = map { $pos[$_] <=> int($DIM[$_] / 2) } (0,1);
- $quads{ $quad[0], $quad[1] } += $moved{$robot} if (all {$_} @quad);
- }
- say "Part 1: ", product values %quads;
Advertisement
Add Comment
Please, Sign In to add comment
-
✅⭐ Make $2500 in 15 minutes ✅ NEVER SEEN BEFO...
JavaScript | 3 sec ago | 0.24 KB
-
⭐ Instant BTC Profit Method ✅ NEVER SEEN BEFO...
JavaScript | 16 sec ago | 0.24 KB
-
⭐ Instant BTC Profit Method ✅ NEVER SEEN BEFO...
JavaScript | 23 sec ago | 0.24 KB
-
⭐✅ MAKE $2000 INSTANTLY ✅ NEVER SEEN BEFORE ⭐...
JavaScript | 32 sec ago | 0.24 KB
-
⭐ Free Crypto Method ✅ NEVER SEEN BEFORE ⭐⭐⭐
JavaScript | 41 sec ago | 0.24 KB
-
✅⭐ Make huge profits on trading ✅ NEVER SEEN...
JavaScript | 51 sec ago | 0.24 KB
-
⭐✅ Marketplace Glitch ✅ Working ✅ NEVER SEEN...
JavaScript | 1 min ago | 0.24 KB
-
✅⭐ Make $2500 in 15 minutes ✅ NEVER SEEN BEFO...
JavaScript | 1 min ago | 0.24 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand