Can I go to the beach??

I’m 20 weeks pregnant and I went to the doctor yesterday and she said I have a yeast infection and prescribed me this stuff to insert into my vagina once a day for 7 days. (I’ve never had a yeast infection in my life) so this is all new to me. Can I still go to the beach and get in the water even tho I have that stuff in my vagina?? Will it make my infection worst?? Or could it make the medicine not work??