Measurement of partial widths and search for direct CP violation in D0 meson decays to K−K+ and π−π+