Elastic and inelastic scattering of 50 MeV protons by 12C and 16O