Z43
IPO Capital and Project Selection
Problem Statement & Objective
Pick at most k distinct projects from given projects to maximize your overall capital before starting the IPO.
Function Signature (Python)
ipo_capital_and_project_selection(k: int, w: int, profits: list[int], capitals: list[int]) -> intInput & Output Contract
Output Rule:Maksimum nihai sermaye tam sayısı.
System Constraints
1 <= k <= 10^5
0 <= w <= 10^9
1 <= karlar.length == sermayeler.length <= 10^5
0 <= karlar[i], sermayeler[i] <= 10^4Example Execution Walkthrough
k = 2, w = 0, karlar = [1, 2, 3], sermayeler = [0, 1, 1]
0 sermaye ile 0. proje -> sermaye 1 olur. 1 sermaye ile 2. proje (kâr 3) -> sermaye 4 olur -> cevap: 4Example Test Scenarios (3)
Example 1
Input:
[2,0,[1,2,3],[0,1,1]]Expected Output:
4Example 2: Üç Proje Birden
Input:
[3,0,[1,2,3],[0,1,2]]Expected Output:
6Example 3: Hiçbiri Yapılamaz
Input:
[1,2,[1,2,3],[3,4,5]]Expected Output:
2