Data Structures & AlgorithmsVery hardCodeforces Div2 D · ICPC regional
Books have page counts [12, 34, 67, 90, 25, 40, 18] in this fixed order. They are split among K = 3 students so that each student receives a contiguous block of books. What is the smallest possible value of the largest number of pages given to any one student?
- A. 173
- B. 113
- C. 95
- D. 90
Correct answer: B. 113
Binary search the answer cap between max(b) and sum(b); a cap is feasible if a greedy pass needs at most K students. The average (sum/K) is only a lower bound, and the largest single book is another, so neither is the answer.
Practise more Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questionsArrays, Strings, Linked Lists, Stacks, Queues and Hashing: notes and key points
More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions
- Koko has banana piles [3, 6, 7, 11] and H = 8 hours. Each hour she eats up to k bananas from ONE pile (if a pile has fewer, she finishes…
- For the array [19, 4, 33, 12, 7, 29], find the smallest positive integer d such that the sum of ceil(x / d) over all elements is at most…
- In a 3 × 5 multiplication table (entries i × j for 1 ≤ i ≤ 3, 1 ≤ j ≤ 5), with repeats counted, what is the 7-th smallest entry?
- Flowers bloom on the days [1, 10, 3, 10, 2] (one flower per position). You need m = 3 bouquets, and each bouquet needs k = 1 adjacent…
- Wood sticks have lengths [232, 124, 456] (integers). You need K = 7 pieces of EQUAL integer length, and you may cut each stick into as…
- How many unordered pairs of positions (i < j) in [9, 1, 6, 14, 3, 11, 7] have an absolute difference of at most 4?