For checking whether bijective, the function is to be injective and surjective. If A=0, f(1)=f(2)=B (for example). Hence this is not injective. Hence not bijective.
Next, for A={-1,1}, f(x) is becoming injective and for every element in the codomain of f, there is at least one element in the domain of f such that f(x) = y. So this is surjective.