The Legend Was Invented, but Not the Name#11695

The Legend Was Invented, but Not the Name (Editorial)

1st group)

You can print only c[i] = 1 k[i] = x

It works because

1^2 + 1^2 + 1^2 + ... + 1^2 = x*1^2 = x

1^3 + 1^3 + 1^3 + ... + 1^3 = x*1^3 = x = y

2nd group)

x^3 > x^2 (x > 1) then a[0]^2 + a[1]^2 + ... + a[n]^ 2 \le a[1]^3 + a[2]^3 ... a[n] ^ 3

if x > y then there is no answer

print

3nd group)

We can solve it using dp

where dp[i] - is true is we can go to state where y - x = i

4s group)

1) (y - x) \equiv 1(mod print

2) y - x < 0 print

main idea: there is answer where c[i] \le 3

Solution :

if (y - x) \equiv 2(mod

c[0] = 3 k[0] = 1

c[1] = 2 k[1] = (y - x - 18)/ 4

c[2] = 1 k[2] = x - 9 - k[1]*4

if (y - x) \equiv 0(mod

c[0] = 2 k[0] = (y - x)/ 4

c[1] = 1 k[1] = x - k[0]*4