We determine the ground-state energy and Tan's contact of attractively interacting few-fermion systems in a one-dimensional harmonic trap, for a range of couplings and particle numbers. Complementing those results, we show the corresponding density profiles. The calculations were performed with a new lattice Monte Carlo approach based on a non-uniform discretization of space, defined via Gauss-Hermite quadrature points and weights. This particular coordinate basis is natural for systems in harmonic traps, and can be generalized to traps of other shapes. In all cases, it yields a position-dependent coupling and a corresponding non-uniform Hubbard-Stratonovich transformation. The resulting path integral is performed with hybrid Monte Carlo as a proof of principle for calculations at finite temperature and in higher dimensions. We present results for N=4,...,20 particles (although the method can be extended beyond that) to cover the range from few- to many-particle systems. This method is also exact up to statistical and systematic uncertainties, which we account for -- and thus also represents the first ab initio calculation of this system, providing a benchmark for other methods and a prediction for ultracold-atom experiments.