An optimization approach to a two-dimensional electromagnetic inverse problem in the time domain is considered. Wave-splitting is integrated in the optimization algorithm. The permittivity, permeability, and conductivity are reconstructed by minimizing an objective functional. To speed up the computation time, an explicit expression for the gradient of the objective functional is derived by introducing dual functions and using the Gauss surface divergence theorem. The parameters are then reconstructed by an iterative conjugate gradient algorithm. Numerical results for a simultaneous reconstruction of the permittivity, permeability, and conductivity are presented.