diff options
author | Jack Sangdahl <[email protected]> | 2025-06-27 12:23:02 -0600 |
---|---|---|
committer | Jack Sangdahl <[email protected]> | 2025-06-27 12:23:02 -0600 |
commit | a96b65cbfad7f62f3db6b2eab105e4e25c0414c5 (patch) | |
tree | e2a2b3f49f9fb741be81415266ac93e74cff42ec /other/max_performance_team.cpp | |
parent | 694ad5ed71edcb1deccab54b72d706b779918276 (diff) | |
download | leetcode-a96b65cbfad7f62f3db6b2eab105e4e25c0414c5.tar.gz leetcode-a96b65cbfad7f62f3db6b2eab105e4e25c0414c5.zip |
chore: remove old cpp and rust solutions
Diffstat (limited to 'other/max_performance_team.cpp')
-rw-r--r-- | other/max_performance_team.cpp | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/other/max_performance_team.cpp b/other/max_performance_team.cpp deleted file mode 100644 index a7e4be8..0000000 --- a/other/max_performance_team.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include "leetcode.h" - -class Solution { -public: - const int mod = 1e9 + 7; - int maxPerformance(int n, vector<int> &speed, vector<int> &efficiency, - int k) { - priority_queue<int, vector<int>, greater<int>> pqvg; - vector<pair<int, int>> vp; - for (int i = 0; i < n; i++) - vp.push_back({efficiency[i], speed[i]}); - sort(vp.rbegin(), vp.rend()); - long totSpeed = 0, ans = 0; - for (int i = 0; i < n; i++) { - int currEff = vp[i].first, currSpeed = vp[i].second; - if (pqvg.size() == k) { - totSpeed -= pqvg.top(); - pqvg.pop(); - } - pqvg.push(currSpeed); - totSpeed += currSpeed; - ans = max(ans, totSpeed * currEff); - } - return ans % mod; - } -}; - -int main() { - Solution obj; - int n = 6, k = 2; - vector<int> speed = {2, 10, 3, 1, 5, 8}, efficiency = {5, 4, 3, 9, 7, 2}; - cout << obj.maxPerformance(n, speed, efficiency, k); -} |