On the 16th Hilbert problem for discontinuous piecewise polynomial Hamiltonian systems