So Rio pulled it off, successfully delivering perhaps the most doubted Olympic Games of the modern era.