From Given data we can conclude:
Remaining Needs: P1= 25 (70-45), P2= 20 (60-40), P3= 60-X , P4= 40 -Y // (Max - currently holds)
And, total units of resource is 150
So, Remaining units of resource will be = 150 - (45+40+X+Y) = 150- (85+X+Y)
Now, check option by option;
Option A: X=40,Y=20
Remaining Needs: P1= 25 (70-45), P2= 20 (60-40), P3= 60-40=20 , P4= 40 -20=20
And Remaining units of resource will be = 150 - (85+40+20) = 150-145 =5
we can't complete any process with remaining 5 units
So, option A is wrong.
Option B: X=50,Y=10
Similarly for B: Wrong
Option C: X=30,Y=20
Remaining Needs: P1= 25 (70-45), P2= 20 (60-40), P3= 60-30=30 , P4= 40 -20=20
And Remaining units of resource will be = 150 - (85+30+20) = 150-135 =15
we can't complete any process with remaining 15 units
So, option C is wrong.
Option D: X=20,Y=30
Remaining Needs: P1= 25 (70-45), P2= 20 (60-40), P3= 60-20=40 , P4= 40 -30=10
And Remaining units of resource will be = 150 - (85+30+20) = 150-135 =15
Now we can complete P4 first then others . SAFE SEQUENCE
So, ANSWER IS OPTION D