The time to stay in shape and muscle depends on many factors, including your genes, diet, exercise plan and lifestyle. Generally speaking, it takes about 6 months to 1 year to see the obvious effect if you do aerobic exercise 3-5 times and strength training 2-3 times a week and maintain healthy eating habits.
However, it should be noted that everyone's physical condition and metabolic rate are different, so the time to reach the goal will be different. In addition, if you want to keep your body and muscles for a long time, you need to keep exercising and keep a healthy lifestyle.