This challenge is based on another similar challenge. Because finding the most efficient packing of rectangles is NP-hard (that is, its solution is easy to check but hard to find), this challenge is a lot easier than this one here
Given a bunch of rectangles, figure out whether or not they fill a rectangular space with no gaps or overlaps.
Input can be in two forms, one of which carries a scoring penalty.
The first: it contains a list of sublists, each with length 4. This list contains 4 integers which are the coordinates of opposite vertexes. Since all rectangles will be horizontal/vertical, there is no ambiguity as to where the rectangle is. Each sublist will contain four integers, which, in order, are the x-coordinate of the first vertex, the y-coordinate of the first vertex, the x-coordinate of the second vertex, and the y-coordinate of the second vertex.
The second: it contains four lists of integers with the same length. The four lists represent the different coordinates. If you imagine input option 1 as a matrix, the input here is just the transpose of the matrix. This input carries a
+20% byte penalty.
Simple truthy/falsy output.
If there is a rectangle with area 0 (that is,
x1 == x2 || y1 == y2), disregard this rectangle (so
[0 0 1 1], [2 2 3 2] is valid). This specification is in place to make it harder for people to simply get the min/max x/y values.
x1 <= x2 and
y1 <= y2 are not always true. If
x1 > x2 || y1 > y2, the rectangle is not a zero-area rectangle; rather, it occupies the rectangular space between
(x1, y1) and
Coordinates can be negative, in which case they still occupy the space between the coordinates.
The top-left-most rectangle is not always at
(0, 0); thus, the rectangular space that is filled doesn't necessarily have its top-left corner at
(Thanks to @xnor for pointing out these ambiguities)
Please specify how you want your input and how your output will be represented.
Score is the size of the code in bytes, plus a byte penalty if applicable. Lowest score as of December 15th wins.
0 0 1 2 1 0 3 1 ==> true 1 1 3 2 0 0 2 2 0 0 1 1 ==> false 0 0 0 0 0 0 1 1 2 2 2 2 ==> true 0 1 2 1
Good luck, happy golfing!