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 Go (1.14.1) (judge verdict: Runtime Error)

package main

import (
	"fmt"
	"math"
)

func main() {
	var x int
	var factor []int
	var front, back int

	fmt.Scanf("%d", &x)

	factor = makeDivisors(x)
	// fmt.Print(factor)

	for k := 0; k < len(factor); k++ {
		front = factor[k]
		back = x / factor[k]
		if check(front, back) == true {
			return
		}
	}

}

func makeDivisors(n int) []int {
	divisors := make([]int, 0, n)
	for i := 1; i < int(math.Sqrt(float64(n))+1); i++ {
		if n%i == 0 {
			divisors = append(divisors, i)
			if i != n/i {
				divisors = append(divisors, n/i)
			}
		}
	}

	return divisors
}

func check(front int, back int) bool {
	for i := 0; i < front; i++ {
		a := float64(i)
		b := a - float64(front)
		if float64(back) == (math.Pow(a, 4) + math.Pow(a, 3)*b + math.Pow(a, 2)*math.Pow(b, 2) + a*math.Pow(b, 3) + math.Pow(b, 4)) {
			fmt.Print(int(a))
			fmt.Print(" ")
			fmt.Print(int(b))
			return true
		}
	}
	return false
}

func PrimeFactors(n int) (pfs []int) {
	for n%2 == 0 {
		pfs = append(pfs, 2)
		n = n / 2
	}

	for i := 3; i*i <= n; i = i + 2 {
		for n%i == 0 {
			pfs = append(pfs, i)
			n = n / i
		}
	}

	if n > 2 {
		pfs = append(pfs, n)
		pfs = append(pfs, 1)
	}

	if n == 1 {
		pfs = append(pfs, 1)
	}

	return
}