Chess Grandmaster in Problem Solving – A famous chess grandmaster was analyzing one of his games in his head and…

A famous chess grandmaster was analyzing one of his games in his head and… he suddenly forgot the positions of two important pieces.

However, he is sure about some facts:

• the location of the first piece on the board is (x1; y1) and xl1 <= x1 <= xr1, yl1 <= y1 <= yr1
• the location of the second piece on the board is (x2; y2) and xl2 <= x2 <= xr2, yl2 <= y2 <= yr2
• the chessboard cells corresponding to the pieces are of the same color

In other words, he doesn’t remember the exact positions of the pieces, however, for every piece, he is sure about the part of the board where it can be. Part of the board here is just a rectangular submatrix described by 4 coordinates.

Note: obviously, two pieces can’t be in the same location.

Now the grandmaster is wondering, how many placements of this two pieces are possible if he remembers everything correctly?

A Must-Read Guide to Improve Talent Acquisition Strategy in 2022

In current scenario,...

We are elated...