advent_of_code/2023/05/seed.go
2023-12-10 16:38:37 +01:00

31 lines
847 B
Go

package main
type IntervalSort [][2]uint64
func (is IntervalSort) Len() int { return len(is) }
func (is IntervalSort) Swap(i, j int) { is[i], is[j] = is[j], is[i] }
func (is IntervalSort) Less(i, j int) bool { return is[i][0] < is[j][0] }
type MapperSort []Mapper
func (ms MapperSort) Len() int { return len(ms) }
func (ms MapperSort) Swap(i, j int) { ms[i], ms[j] = ms[j], ms[i] }
func (ms MapperSort) Less(i, j int) bool { return ms[i].source < ms[j].source }
type Input struct {
seedIntervals [][2]uint64
seedToSoil []Mapper
soilToFertilizer []Mapper
fertilizerToWater []Mapper
waterToLight []Mapper
lightToTemperature []Mapper
temperatureToHumidity []Mapper
humidityToLocation []Mapper
}
type Mapper struct {
source uint64
target uint64
count uint64
}