Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- wide, tall=101,103
- parse_coords(coord_str) = parse.(Int, split(split(coord_str, "=")[2], ","))
- robots = split.(readlines("input"))
- positions = [mod.(pos .+ vel .* 100, [wide, tall]) for robot in robots]
- quadrants = [
- count(el -> el[1] > wide ÷ 2 && el[2] > tall ÷ 2, positions),
- count(el -> el[1] > wide ÷ 2 && el[2] < tall ÷ 2, positions),
- count(el -> el[1] < wide ÷ 2 && el[2] > tall ÷ 2, positions),
- count(el -> el[1] < wide ÷ 2 && el[2] < tall ÷ 2, positions)
- ]
- println(prod(quadrants))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement