Configuration-interaction Monte Carlo method and its application to the trapped unitary Fermi gas