Distance=speed×time, so time=distance/speed.
I assume that ⅓ and ½ refer to the distance AB, which we’ll call d km.
If J and Y are the times that Jimmy and Yuri take to go from A to B, the total time it takes Jimmy is:
J=(d/3)/5+(d/3)/4.5+(d/3)/4=(d/3)(1/5+1/4.5+1/4).
J=(d/3)(1/5+2/9+1/4)=(d/3)(36+40+45)/180=121d/540.
Y=(d/2)(1/4+1/5)=9d/40.
The difference in time is Y-J=d(9/40-121/540)=(d/1080)(243-242)=d/1080.
Yuri took 30secs longer to get to B, and 30secs=1/120 hr.
Therefore d/1080=1/120, d=1080/120=9km.
The distance between the cities is 9km.