In my neighborhood, there is a gym currently under control of my team (Team Instinct-Yellow) where all the Pokémon have 1000+ CP. I just started playing the game yesterday and the highest level Pokémon I have so far is 135 CP, so I have no chance of winning.
I read that training can help a friendly gym by having it gain prestige. Does it help my team's gym if I train there, but lose? Or do I have to actually win?