If the two teams were exactly identical, and they divided up the work in the 2/3 and 1/3 split, or any other split at all, and they finished the job in 40 days, then each team alone would take 40 days to do the job. If the teams aren't identical (which they aren't, from the answer choices), one must take longer than 40 days, and one must take less than 40 days. Only answer A is even possible, without even looking at the 18 days information.
That might seem a bit abstract to someone who isn't accustomed to thinking about rates conceptually, so I can explain in reverse. Say you had the teams in answer choice B, so team A takes 40 days alone, and team B takes 30 days alone. If you give all of the work to team A, it will take 40 days, and if you give all of the work to team B, it will take 30 days. If you give some of the work to A, and the rest to B, it will take somewhere between 30 and 40 days, depending on how you divide up the work. So answer B is impossible, because it did not take somewhere between 30 and 40 days when the work was divided between the two teams -- it took 40 days, so one team must take longer than that working alone (unless the two teams both take exactly 40 days).