Assume that there are certain types of investment projects that can increase your money. Let's assume that project i need investment a; to be done. Once the project is established, it returns your initial investment and gives you an additional profit b₁. Each project may be established once. Currently you have an amount of money equal p. Note that you can't establish a project that takes more money than what you currently have. Your task is to find the maximum possible profit out of these projects. Input The first line contains the integers n and p, where n is the number of available projects and p is your initial amount of money. Then two lines follow, each containing n integers describing the arrays a and b [Note: a; the amount of money that you have to invest (spend) to establish the project i. b;: the amount of revenue that you get as an addition to the amount of money already spent to establish the project i. Output For each test case, output a single value that present the maximum profit you can achieve. Example Ex1 np a₁ →→ b; → Ex2 np a; → b; → Ex3 np a; → b; → input 5 $200 $200 $200 $500 $200 $200 $200 $200 $200 $200 $200 3 $150 $200 $400 $150 $90 $1000 $50 5 $80 $1280 $640 $320 $160 $80 $1280 $640 $320 $160 $80 output $1000 $140 $2480
Assume that there are certain types of investment projects that can increase your money. Let's assume that project i need investment a; to be done. Once the project is established, it returns your initial investment and gives you an additional profit b₁. Each project may be established once. Currently you have an amount of money equal p. Note that you can't establish a project that takes more money than what you currently have. Your task is to find the maximum possible profit out of these projects. Input The first line contains the integers n and p, where n is the number of available projects and p is your initial amount of money. Then two lines follow, each containing n integers describing the arrays a and b [Note: a; the amount of money that you have to invest (spend) to establish the project i. b;: the amount of revenue that you get as an addition to the amount of money already spent to establish the project i. Output For each test case, output a single value that present the maximum profit you can achieve. Example Ex1 np a₁ →→ b; → Ex2 np a; → b; → Ex3 np a; → b; → input 5 $200 $200 $200 $500 $200 $200 $200 $200 $200 $200 $200 3 $150 $200 $400 $150 $90 $1000 $50 5 $80 $1280 $640 $320 $160 $80 $1280 $640 $320 $160 $80 output $1000 $140 $2480
Operations Research : Applications and Algorithms
4th Edition
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Wayne L. Winston
Chapter11: Nonlinear Programming
Section11.13: Pareto Optimality And Tradeoff Curves
Problem 5P
Related questions
Question
can you solve this on python please ?
a) Design a brute-force
b) Design a more efficient algorithm to do the same task with less complexity and analyse the complexity of your solution. [Important instruction to be followed: Create an arbitrary input of at least 5 projects and use it to provide full explanation of how your proposed algorithm should work step by step]
c) Develop a python code to implement your efficient algorithm.
and can you please compare between the algorithms
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 3 images