Comments
+3

I've just got AC.

You should use these two ideas to get AC.

  • Use shouldn't solve the general knapsack problem to get the first answer for the test case. Surprisingly, the Pollock's conjecture will help you to solve this problem efficiently :) Consider the fact, that possible answers are 1,2,3,4,5. So you can just brute-force the answers for 1,2 and 3. Then you can add tetrahedral number for every x that d[x] = 3, thus finding all the y that d[y] = 4. The answer for the remaining numbers is 5.

  • There are only 45 odd tetrahedral numbers and there are no any conjectures about them. So you should use the most general dp approach.

If you have any more questions about this solution feel free to ask them :)

On RipattiCodeforces Beta Round #81, 15 years ago
0
And how can I enable APNG in Chrome?
D is also my favourite problem in this problem set :)
And the whole problem set is very nice. It is very diverse: easy implementation, math, dp/classic, geometry. And problems do not require extraodinary knowledge in algorithms.
This round was very suitable for Div2.
On Alex_KPRCodeforces Beta Round #58, 15 years ago
+1
Exactly!

I lost two submissions and got hacked because of that.

Problem statement is a complete disaster. Author of this problem is the only person who knows about martian physiology.
Something like this:
1 0 1