How much weight did you gain, and how's your body composition (fat etc)?
As for fat loss while maintaining muscle, this depends mostly on how low your calories go. Too low and for too long = muscle loss risk
Muscles will not stay if there is not enough to support them (diet and strength).
Worse thing people do on a cut is doing things too drastically (starving/excessive exercise) and changing crap up so much to the point of confusion/misdirection.