It is understood that for least time to fill up the tank, P should be opened for the maximum time.
=> P should be opened for 1 hour after 10 am
R is open at all times
In this one hour, the proportion of tank which is has been filled is (1/3 - 1/5) = 2/15
After the 1 hour, Q is opened for a mandatory 15 mins while P is closed
In these 15 mins, the proportion of tank which has been filled up is (1/16 - 1/20) = 1/80
So, for a cycle of 1 hours 15 mins, tank filled is (2/15) + (1/80) = 35/240
The above cycle has to be repeated till the tank is filled.
It can be seen that this will run for 6 complete cycles, and the tank will be filled in the 7th cycle when P is opened with R (Since 35/240*6 is 210/40, and 35*7/240>1)
6 cycles of 1 hours 15 mins yields 7 hours 30 mins. => Time after 6 cycles is 17:30 hours
Tank remaining empty is 1 - 35*6/240 = 1/8
1/8 tank will be filled by P and R open
(1/8)/(2/15) = approximately 1 hour.
Time at the time of finishing 18:30.
I think assuming hourly rates of a cycle works only when rates of P and Q are comparable and the size of the cycle is not too big. Otherwise, the approximation may result into wrong answer.