Exercise performance on diet without flour and sugar

In the past I have gone 4-6 weeks of eating a low carb diet (while following the Diet Doctor’s meal planning / food suggestions). That diet was very similar to what I would be eating if I cut out flour and sugar, as you recommend. However, after about 4-6 weeks into this food lifestyle change, I tried to race a half marathon (which I do almost every summer), and I felt absolutely horrible. I had no energy. Then I tried to drink some gatorade to give me some energy during the race, and had terrible gastrointestinal effects. I’m worried that cutting flour and sugar will have the same effects on exercise ability.