adventofcode/2018/day03-2.go

35 lines
556 B
Go

package main
import (
"fmt"
"internal/day03"
"internal/util"
)
func main() {
data := util.ReadInput()
claims, maxX, maxY := day03.ParseClaims(data)
day03.PopulateGrid(claims, maxX, maxY) // ignoring return value because we only want the side effect here
id := -1
count := 0
for _, claim := range claims {
if !claim.Overlaps {
id = claim.ID
count++
}
}
if count > 1 {
fmt.Printf("%d claims detected no overlap. :(\n", count)
return
}
if count == 0 {
fmt.Println("All claims overlapped. :(")
return
}
fmt.Println(id)
}