hi
see
see let the name of the trains be A(with 50km/hr) & B(with 40km/hr)
now since they are moving in opposite directions therefore velocity of train A w.r.t B = 50+40 = 90km/hr = 25m/sec
similarly acceleration of A w.r.t B will become 0.3 + 0.2 = 0.5m/sec^2
therefore it now becomes a case in which train A is moving with speed of 25m/s
& acceleration of 0.5m/s^2 has to overtake a stationary train B
therefore it's also clear that train A needs to travel 200m to cross train B
therefore using
s = ut+ 1/2at^2
200 = 25t + 1/2 * 0.5 * t^2
solve for t to get the answer