Problem:
Score : 400 points

Problem Statement

Give a pair of integers (A, B) such that A^5-B^5 = X.
It is guaranteed that there exists such a pair for the given integer X.

Constraints

1 \leq X \leq 10^9

X is an integer.

There exists a pair of integers (A, B) satisfying the condition in Problem Statement.

Input

Input is given from Standard Input in the following format:

X

Output

Print A and B, with space in between.
If there are multiple pairs of integers (A, B) satisfying the condition, you may print any of them.

A B

Sample Input 1

33

Sample Output 1

2 -1

For A=2 and B=-1, A^5-B^5 = 33.

Sample Input 2

1

Sample Output 2

0 -1

Solution in C++ (GCC 9.2.1) (judge verdict: Accepted)

#include <bits/stdc++.h>
#define REP(i, n) for(long long i=0; i<n; i++)
#define REPR(i, n) for(long long i=n-1; i>=0; i--)
#define FOR(i, m, n) for(long long i=m; i<=n; i++)
#define FORR(i, m, n) for(long long i=m; i>=n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;
const ll inf = 1e15;

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int main(){FIN

    ll x; cin>>x;
    if (x==1){
        cout<<1<<' '<<0<<endl;
        return 0;
    }

    vll ret = divisor(x);

    for(auto p:ret){
        ll b=0; ll a=p;
        ll f;
        if(pow(a,5)-pow(b,5)>x) f=1;
        else f=0;

        while(f){
            a--; b--;
            if(pow(a,5)-pow(b,5)==x){
                cout <<a<<' '<<b<<endl;
                return 0;
            }
            if(pow(a,5)-pow(b,5)<x) break;
        }

        while(!f){
            a++; b++;
            if(pow(a,5)-pow(b,5)==x){
                cout<<a<<' '<<b<<endl;
                return 0;
            }
            if(pow(a,5)-pow(b,5)>x) break;
        }
    }
    cout<<-1<<endl;
    return 0;
}