Ab initio calculation of atomic negative-ion states in the polarized frozen-core approximation. I. The attachment energies for O-(2P0) and C-(4S0)