Блог пользователя akshit5638

Автор akshit5638, история, 4 месяца назад, По-английски

we have an array of size n.each element of array is between 1 and 10.we are also given an integer k.We can divide array in atmost k subsets.After dividing, each element should belong to exactly one subset.We have to tell if it is possible to divide such that every subset sum<=10

constraints:

test case,t<=100

n<=1000

1<=a[i]<=10

1<=k<=100

example

t=1

n=12

2 1 2 5 4 3 6 1 1 9 3 2

k=4

than a valid division is

[9,1],[6,1,3],[5,2,3],[4,2,2,1]

Полный текст и комментарии »

  • Проголосовать: нравится
  • +9
  • Проголосовать: не нравится