Another optimization over this: we actually only need 2 points (the opposite points) to define a rectangle. Let these opposite points be some: (xi, yi) and (xj, yj). Then the other 2 opposing points will be: (xi, yj), (xj, jy). We can check for their existence via a map (after storing them obviously), and then finding area and and checking for inside points can be the same. This lowers complexity from O(n^5) to O(n^3), since we are only brute forcing a combination of 2 points. This allows the code to pass for n
Today last question Consider every point as top left point and binary search for left closest point to it and with same y cordinate then same way for bottom closest point with same x coordinate then we get fourth point now there one more thing you need to check is there any point in the formed rectangle . I am not sure is there any standard searching algorithm in cpp for this kind of search
Agar accha lage & aur Contest Solutions ke naam pr ek like thok dena plssss
Another optimization over this: we actually only need 2 points (the opposite points) to define a rectangle. Let these opposite points be some: (xi, yi) and (xj, yj). Then the other 2 opposing points will be: (xi, yj), (xj, jy). We can check for their existence via a map (after storing them obviously), and then finding area and and checking for inside points can be the same. This lowers complexity from O(n^5) to O(n^3), since we are only brute forcing a combination of 2 points. This allows the code to pass for n
🥰🥰🥰🥰🥰
Today last question
Consider every point as top left point and binary search for left closest point to it and with same y cordinate then same way for bottom closest point with same x coordinate then we get fourth point now there one more thing you need to check is there any point in the formed rectangle . I am not sure is there any standard searching algorithm in cpp for this kind of search
Today's last q involved fenwick trees ig