Round 334 Div 2 Editorial for first two problems

Правка en2, от 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

Теги 334, editorial

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский 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 Английский Karan2116 2015-12-02 00:38:13 765 Initial revision (published)