def catalan_dynamic(n: int) -> int:
    """
    Returns the nth catalan number with polynomial time complexity.
    >>> catalan_dynamic(5)
    42
    >>> catalan_dynamic(10)
    16796
    >>> catalan_dynamic(0)
    1
    >>> catalan_dynamic(-5)
    1
    >>> catalan_dynamic(1.5)
    -1
    """
    if not isinstance(n, int):
        return -1
    if n <= 1:
        return 1
    numbers = [0] * (n + 1)
    numbers[0], numbers[1] = 1, 1

    for i in range(2, n + 1):
        for j in range(i):
            numbers[i] += numbers[j] * numbers[i - j - 1]
    return numbers[-1]