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: Time Limit Exceeded)

#include <bits/stdc++.h>
#define rep(i, a) for(int i = 0; i < a; i++)
#define all(v) v.begin(), v.end()
#define dcout cout << fixed << setprecision(15)
#define arep(i, a) for(auto i : a)
#define F first
#define S second
#define VE vector<int>
#define pb(x) push_back(x)
#define MOD 1000000007
#define INF 10000000000
#define NUM 100
#define int long long
#define KETA(n) floor(log10(n) + 1)
using namespace std;
signed main() {
    int a;
    vector<int> v;
    cin >> a;
    int ans = a;
    int c = a;
    a = sqrt(a);
    int sosu[a + 1];
    int i, j;
    int k = 0;

    for(i = 1; i <= a; i++)
        sosu[i] = 1;

    sosu[1] = 0;

    for(i = 2; i <= a; i++) {
        if(sosu[i] == 1) {
            for(j = 2; i * j <= a; j++) {
                sosu[i * j] = 0;
            }
        }
    }

    for(i = 1; i <= a; i++) {
        if(sosu[i] == 1) {
            k++;
        }
    }
    int b[k];
    int n = k;
    for(i = 1; i <= a; i++) {
        if(sosu[i] == 1) {
            b[k - n] = i;
            n--;
        }
    }
    n = 0;
    do {
        if(c % b[n] == 0) {
            c = c / b[n];
            v.pb(b[n]);
        } else
            n++;
    } while(n < k);
    if(c != 1)
        v.pb(c);
    v.pb(ans);
    //ここまででxの素因数分解
    int x = v[0];
    int jj = 0;
    while(1) {
        int k = jj - x;
        // cout << jj << " " << k << endl;
        if((pow(jj, 5) - pow(k, 5)) == ans) {
            cout << jj << " " << k << endl;
            return 0;
        }
        jj++;
    }
    return 0;
}