Exact self-accelerating cosmologies in the ghost-free bigravity and massive gravity