Prompt proton and electron acceleration to relativistic energies in solar flares