2018-12-03 21:53:58 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
2018-12-10 06:06:47 +00:00
|
|
|
"internal/day03"
|
2018-12-03 21:53:58 +00:00
|
|
|
"internal/util"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
data := util.ReadInput()
|
2018-12-10 06:06:47 +00:00
|
|
|
claims, maxX, maxY := day03.ParseClaims(data)
|
|
|
|
day03.PopulateGrid(claims, maxX, maxY) // ignoring return value because we only want the side effect here
|
2018-12-03 21:53:58 +00:00
|
|
|
|
|
|
|
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)
|
|
|
|
}
|