Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem 2 . The gold mining company Gold 3 3 6 wants to buy a lot of land. It has a list of available lots
Problem The gold mining company Gold wants to buy a lot of land. It has a list of available
lots LOTS. Each lot is an axisparallel rectangle with coordinates LOTS LOTSLOTS
LOTS The cost of the lot is LOTS cost The company also has a list of gold mines GOLDMINES.
Mine has coordinates goldMines and GOLDMines and value GoldMines value. The
total revenue that Gold can get from lot i equals the sum of values of gold mines located on
the property boundaries are included The profit from the lot equals the revenue from that lot
minus its cost. Your goal is to design an algorithm that finds the best lot. Lots do not overlap, ie
they are disjoint rectangles. Lots are nondegenerate rectangles, meaning lots and
lots lots There might multiple gold mines the same location.
Please, design algorithm for this problem. Implement the following function.
long long int FindBestLot vector& lots,
const vector& goldMines
The function should return the profit the most profitable lot. The parameters are follows: lots
the list lots; goldMines the list gold mines.
Submission The instructions are similar the previous homeworks. Your program must pass
each test more than second. You can assume that the number lots and the number
gold mines most and least one lot exists. All other numbers are between and
#include
using std::vector;
struct Lot
int x y;
int x y;
int cost;
Lotint x int y int x int y int cost: xx yy xx yy costcost
;
struct GoldMine
int x y;
int value;
GoldMineint x int y int value: xx yy valuevalue
;
long long int FindBestLotconst vector& lots, const vector& goldMines
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started