Code forces round702 div 3 problem c sum of cubes

This is regarding cf round 702 div3 problem c.
Question link: Problem - C - Codeforces

My sol:

bool iscube1(ll n)


    for(ll i=1;i*i*i<n;i++)


        ll x=n-i*i*i;

        ll y=cbrt(x);



            return true;




    return false;


can we solve the above problem in O(1)?I am curious to about it.I read an post in math stack exchange,I didn’t get exactly how to implement that.
I want to know if there is any way that we can do that in O(1)? :thinking:
math stack exchange post link: Numbers that can be expressed as the sum of two cubes in exactly two different ways - Mathematics Stack Exchange

Is there any other way with very less time complexity?

Still waiting for the answer

Have you checked this? The editorialist used map to do it in N^(1/3) complexity.