Help me sort out my desktop windows! It's really frustrating when I'm working and I have a ton of windows open that are completely or partially hidden behind other windows. To make things worse, I'm still using two 1024x768 monitors.

Your task is to take a list of coordinates that designate the area, in pixels, on a screen, that a list of windows occupy and output a truthy value if, for a 2 monitor set-up with 1024x768 resolution, all the following conditions are met:


None of the windows would overlap,
None of the windows would be partly off screen
None of the windows would straddle a boundary between the two monitors (so the order in which you visualize monitors 1 and 2 is irrelevant)


And a falsey value if any of these criteria are not met.

You may assume that all windows are rectangular, and that no coordinates are negative in the input, which is in a file, in stdin, or in a list of tuples, is in the following format:

monitor-number left-x bottom-y right-x top-y
monitor-number left-x bottom-y right-x top-y
monitor-number left-x bottom-y right-x top-y


Where each line contains the ID of the monitor (which can either be in [1, 2] or [0, 1] depending on which is easier for your language), and the dimensions of a window.

For example, the following input will result in a truthy output because none of the windows overlap:

1 10 10 100 200
1 210 300 600 600
2 10 10 100 200


The following input will result in a falsey value because lines 1 and 3 result in an overlap:

1 10 10 50 50
2 5 5 600 200
1 20 20 80 80


The following input will result in a falsey value because it would partially off-screen on one of the monitors:

1 1000 400 1400 300 


This is code-golf so the shortest solution wins.
Jelly, 33 bytes

&lt;⁽¡ð,769FẠ
Ḋs2Zr/€p/;€Ḣµ€ẎµQL⁼LȧÇ


A monadic link taking a list of lists of the window-data and returning 0 if any windows exceed their monitor's space or overlap, or 1 otherwise.

Uses 1-indexed monitor IDs; 1,1 to 1024,768 inclusive are considered on-screen.

Try it online! (Too slow for the first two test cases! Typical golf :))

How?

The reason this is so slow is because it creates all the pixels for all the windows, each with its monitor ID and checks for overlap using de-duplication (which is implemented using lists not sets). It also checks each pixel is on-screen rather than checking just the input corners. All in all very inefficient...

Test-case 1 succeeded (1) locally in only eleven minutes! Test-case 2 succeeded (0) in less.

&lt;⁽¡ð,769FẠ - Link 1 check pixels are on-screen: list of lists, each being [x,y,ID]
 ⁽¡ð       - literal base-250 integer = 1025
    ,769   - pair with literal 769
&lt;          - less than (vectorises) -&gt; [[x&lt;1025, y&lt;769, ID],...]
        F  - flatten into a single list
         Ạ - all truthy?

Ḋs2Zr/€p/;€Ḣµ€ẎµQL⁼LȧÇ - Main link: list of lists, each being [ID,Lx,By,Rx,Ty]
            µ€         - for €ach window:
Ḋ                      -   dequeue -&gt; [Lx,By,Rx,Ty]
 s2                    -   split into twos -&gt; [[Lx,By],[Rx,Ty]]
   Z                   -   transpose -&gt; [[Lx,Rx],[By,Ty]]
     /€                -   reduce €ach with:
    r                  -     inclusive range -&gt; [[Lx,...,Rx],[By,...,Ty]]
        /              -   reduce with:
       p               -     Cartesian product -&gt; all pixels, [[Lx,By],[Lx,By+1],...[Lx,Ty],[Lx+1,By],... ...[Rx,Ty]]
           Ḣ           -   head -&gt; ID
         ;€            -   concatenate each pixel with the monitor ID
              Ẏ        - tighten -&gt; one list of all window's [x,y,ID] values
               µ       - monadic chain separation, call that w
                Q      - deduplicate (unique [x,y,ID] values)
                 L     - length
                   L   - length of w
                  ⁼    - equal?
                     Ç - call last link (1) as a monad (all on-screen?)
                    ȧ  - logical and