Random Points Solution Hints

What problem statement means??
Actually, it says to find random but uniform integer points from all the rectangles which means if we have 2 rectangles that contains 10 and 20 points respectively, then "uniform" means that we choose each rectangle.
Like suppose i call pick() 2 times, then for 1st time, you can return interger points from the 1st rectangle and for 2nd you can return from 2nd rectangle.

But while returning the points, it should not happen that suppose 30 times pick() function is called and you return integer points 15-15 times from both the rectangle, as in in 2nd rectangle, still there are 5 points remaining that did get the chance of uniform selection.

Quick Sum up:
-Consider all the rectangle and their points.

  • Consider if a rectangle has used all its points while other rectangles still have unused points.(in this case go for the rectangle that have some points left).
  • Consider the case if all the rectangles have used their points.(in this case, you have to choose all the rectangles again).
  • Check for the boundaries from range of variables given(otherwise TLE will occur).
Comments (0)