Were you dehydrated? Almost certainly. Did the carbs help? Probably not. Some moderate healthy carbs (starchy vegetables and fruit) are one thing, and I find I do need them before or after major workouts (say an hour and a half playing hockey) but pizza and pasta? No. Don't need.
But for the cramps, lots of water and some bananas would have worked just as well.