commit 4381d881f23617d103dcc7b1ba6c164010b37484
parent 845e4ea5336e545433dd678e6f49d51c73ade322
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date: Thu, 11 Apr 2024 14:46:07 +0200
1 Random Problem
Diffstat:
2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/Problems/2064.cpp b/Problems/2064.cpp
@@ -0,0 +1,19 @@
+class Solution {
+ public:
+ int minimizedMaximum(const int n, const vector<int> &quantities) const {
+ int low = 1, high = 100000;
+
+ while (low <= high) {
+ int mid = low + (high - low) / 2, count = 0;
+ for (const int q : quantities)
+ count += (q + mid - 1) / mid;
+
+ if (count <= n)
+ high = mid - 1;
+ else
+ low = mid + 1;
+ }
+
+ return low;
+ }
+};
diff --git a/README.md b/README.md
@@ -993,6 +993,7 @@ for solving problems.
| 2050 | Hard | [Parallel Courses III](Problems/2050.cpp) |
| 2058 | Medium | [Find the Minimum and Maximum Number of Nodes Between Critical Points](Problems/2058.cpp) |
| 2063 | Medium | [Vowels of All Substrings](Problems/2063.cpp) |
+| 2064 | Medium | [Minimized Maximum of Products Distributed to Any Store](Problems/2064.cpp) |
| 2073 | Easy | [Time Needed to Buy Tickets](Problems/2073.cpp) |
| 2074 | Medium | [Reverse Nodes in Even Length Groups](Problems/2074.cpp) |
| 2079 | Medium | [Watering Plants](Problems/2079.cpp) |