Bistability in a self-assembling system confined by elastic walls: exact results in a one-dimensional lattice model.