def decimal_to_binary(n):
    if n == 0:
        return "0"

    is_negative = n < 0
    n = abs(n)

    binary_digits = []
    while n > 0:
        binary_digits.append(str(n % 2))
        n //= 2

    result = "".join(reversed(binary_digits))
    if is_negative:
        result = "-" + result
    return result