Round 334 Div 2 Editorial for first two problems

Revision en2, by Karan2116, 2015-12-02 00:38:51

Problem 1

In this problem we simply use the formula that is given in the problem however it may lead to floating point error.Hence we use the formula sum=sum+max(300*x,(1000-4*m[i])*x-50000*w[i]) and divide the final answer by 1000.
Complexity : O(1)
Code : Problem A

Problem 2

In this problem,we first reverse sort the list of sizes and then allocate the k largest sizes to k blocks then we fill the leftover n-k sizes to those k blocks such that largest of n-k pairs with smallest of k boxes and second largest with second smallest and so on.
Complexity : O(nlog(n))

Code : Problem B

Tags 334, editorial

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Karan2116 2015-12-02 00:38:51 36 Tiny change: '000*w[i])`.\n<br>\nC' -> '000*w[i])` and divide the final answer by 1000.\n<br>\nC'
en1 English Karan2116 2015-12-02 00:38:13 765 Initial revision (published)