Exactly conservative physics-informed neural networks and deep operator networks for dynamical systems