Encoding August 20 Problem Name-Notebook Distribution

Here is the problem link: https://www.codechef.com/ENAU2020/problems/ECAUG205
Please someone explain the problem statement with some test cases ,would be a great help :).And also I wanted to ask that there is no editorial for the problems of August Encoding 2020 @admin @akay_99 please look into this .

You can simply binary search over the answer. Make sure to check if the answer is 0.
https://www.codechef.com/viewsolution/37345796
You can go through my submission and if anything is unclear, then I will be more than happy to help!)

@kanisht09 you can have the editorial
ECAUG205 - Editorial

1 Like

The question asks u to make k books with equal no. of pages out of the N different types such that the all pages of a particular book of a single type ( i.e mixing of different types is not allowed ).You are asked to maximize the no. of pages in the book .
Consider the given testcase :
1
4 11
802 743 457 539

802 —> we get 4 books with pages --> 200,200,200,200 ( Not necessary to use all pages of a particular type)
743 --> we get 3 books with pages 200,200,200
457 -->we get 2books with pages 200,200
539 -->we get 2books with pages 200,200
Total no. of books = 4+3+2+2=11=k.
Approach :
minimum no. of pages we can have is 1, max no. of pages 1e9
so now perform binary search on max no. of pages such that minimum no. of books that can be made out of N different types is K and update your answer.

For more checkout My Submission.

5 Likes

thanks for the reply bro . Actually question was not clear to me and I was unable to understand the logic behind it :frowning:

thank u bro

1 Like

thanks bro I understood the test case now thanks for ur help :slight_smile: :smile:

2 Likes

thanks you bro for giving your precious time and explaining the logic in a beautiful way :slight_smile:

2 Likes

if inputs are like that
1
4 11
802 743 1 539
how output is 179?
help plz

You can make 4 + 4 + 3 = 11 books,
You can check that you cannot get greater than or equal to 11 books using any more pages in a single book.

make 4 books of 179 pages each from 802 pages , then make 4 books of 179 pages each from 743 pages and then 3 books from 539 pages each

1 Like

u have to make 11 books u cannot take more than 179 pages.

1 Like