You didn't fail.
You simply had a lesson in how not to do a century
Maybe you can find one that's not quite so hilly. Ask around.

You did great in fact. Much further than I'll ever be able to ride