Energy resolution and linearity of XENON1T in the MeV energy range