Optimal Architectures in a Solvable Model of Deep Networks