  A general search for the pair production of resonances, each decaying to two
quarks, is reported. The search is conducted separately for heavier resonances
(masses above 400 GeV), where each of the four final-state quarks generates a
hadronic jet resulting in a four-jet signature, and for lighter resonances
(masses between 80 and 400 GeV), where the pair of quarks from each resonance
is collimated and reconstructed as a single jet resulting in a two-jet
signature. In addition, a b-tagged selection is applied to target resonances
with a bottom quark in the final state. The analysis uses data collected with
the CMS detector at the CERN LHC, corresponding to an integrated luminosity of
35.9 fb$^{-1}$, from proton-proton collisions at a center-of-mass energy of 13
TeV. The mass spectra are analyzed for the presence of new resonances, and are
found to be consistent with standard model expectations. The results are
interpreted in the framework of $R$-parity-violating supersymmetry assuming the
pair production of scalar top quarks decaying via the hadronic coupling
$\lambda_{312}''$ or $\lambda_{323}''$, and upper limits on the cross section
as a function of the top squark mass are set. These results probe a wider range
of masses than previously explored at the LHC, and extend the top squark mass
limits in the $\widetilde{\mathrm{t}}$ $\to$ qq$'$ scenario.
