New algorithms for identifying the flavour of B0mesons using pions and protons