Determining how and when Mars formed has been a long-standing challenge for planetary scientists. The size and orbit of Mars are difficult to reproduce in classical simulations of planetary accretion, and this has inspired models of inner solar system evolution that are tuned to produce Mars-like planets. However, such models are typically not coupled to geochemical constraints. Analyses of Martian meteorites using the extinct hafnium-tungsten (Hf-W) radioisotopic system, which is sensitive to the timing of core formation, have indicated that the Martian core formed within a few million years of the solar system itself. This has been interpreted to suggest that, unlike Earth's protracted accretion, Mars grew to its modern size very rapidly. These arguments, however, generally rely on simplified growth histories for Mars. Here, we combine realistic accretionary histories from a large number of N-body simulations with calculations of metal-silicate partitioning and Hf-W isotopic evolution during core formation to constrain the range of conditions that could have produced Mars.