Let mass A move with acceleration 'b' and mass B move with acceleration 'a'.
directions of 'a' and 'b' are different but magnitude of 'a' and 'b' are same.
Since the length of the rope AB is same
acos45=bcos45
a=b
Also Tsin45=mb------(1) for A
mg−Tsin45=ma-----(2) for B
2ma=mg
=>a=g/2
Substituting in (1)