Lucky? Brazil allocated a lot of resources for security too. Not all of which was visible to everyone.
The real question is how much money Brazil may have ended up wasting on all of this. Spending money on big, nationalistic flag waving shows that are very expensive may not be the best use of money in countries that have far more pressing issues to address than some entertainment feel-good program to showcase a country to the world.