aoc_omni/ruby/2025/8/bin/problem
2025-12-08 04:48:46 -05:00

10 lines
272 B
Ruby

#!/usr/bin/env ruby
require "playground"
pg = Playground.for STDIN.read.chomp
pg.connect_circuits!
puts "Part 1: #{pg.circuits.values.uniq.sort_by(&:length).last(3).map(&:length).reduce(&:*)}"
pg.connect_all_circuits!
puts "Part 2: #{pg.last_pair.map(&:x).reduce(&:*)}"