Grand temple Problems

Not able to understand
please explain what I have to to do

Hi @dsingh200021, In this question what is given is one NxM grid and some pillars (Let’s say P pillars) and their coordinates. Now first draw a NxM grid and then place these P pillars at their positions. Now for every pillar you placed, markout the row and the column it passes through for ex if this is the grid:


If we place a pillar at 2,3 then we mark every 2,i and i,3.


Similarly place all the p pillars Now you have some white space(areas in blue boundaries) left like this:


Out of all these left out areas/the blue boundaries/ the maximum area is enclosed in centre with area of 9 sq units.

You just have to tell the largest area that will be there for a given testcase after p pillars have been placed.
There’s a simple greedy solution for this. Which will seem to be incorrect at first place but is actually the correct one.

Hope this helps :slight_smile: