Hi all, ↵
↵
Hope you are all safe with the unfortunate events occurring throughout the world. ↵
↵
↵
↵
I was solving some problems on HackerEarth's CodeArena platform (1v1 other person, 1 problem, 20 mins, who ever gets more TCs wins) , when I came across this problem (the contest has ended). I have attached the screenshot of the statement to this post. ↵
↵
I first attempted to use combinatorics and math to solve it, but later changed to applying DP. However, I couldn't figure out a recurrence between the states (# of objects, # of groups).↵
↵
I would really appreciate it if someone could lend a helping hand with the recurrence.↵
Also, IF there is an easy mathematical solution to the problem, please share it.↵
↵
Thanks for your help and time!↵
BC↵
↵
EDIT: Sorry, I assumed that the 'Add Image' feature automatically appended the image to the post. Attached below is the image.↵
![ ](/predownloaded/3c/9d/3c9d6d6be8bd12b77905568631c528e1a3951d27.png)↵
↵
Sample TC:↵
Input: ↵
4 2↵
↵
Output↵
3
↵
Hope you are all safe with the unfortunate events occurring throughout the world. ↵
↵
↵
↵
I was solving some problems on HackerEarth's CodeArena platform (1v1 other person, 1 problem, 20 mins, who ever gets more TCs wins) , when I came across this problem (the contest has ended). I have attached the screenshot of the statement to this post. ↵
↵
I first attempted to use combinatorics and math to solve it, but later changed to applying DP. However, I couldn't figure out a recurrence between the states (# of objects, # of groups).↵
↵
I would really appreciate it if someone could lend a helping hand with the recurrence.↵
Also, IF there is an easy mathematical solution to the problem, please share it.↵
↵
Thanks for your help and time!↵
BC↵
↵
EDIT: Sorry, I assumed that the 'Add Image' feature automatically appended the image to the post. Attached below is the image.↵
![ ](/predownloaded/3c/9d/3c9d6d6be8bd12b77905568631c528e1a3951d27.png)↵
↵
Sample TC:↵
Input: ↵
4 2↵
↵
Output↵
3