Ya, your answer is absolutely right.
But what I mean that the question is framed in a wrong way .........
Q: When 2gm of A is introduced into an evacuated flask kept at 25oC ,the pressure is found to be 1atm. If 3gm of B is then added to same flask, the total pressure becomes 0.5 atm the ratio of molecular weight of A & B .
Cheers !