First, determine the filling/draining rate for each pipe:
The process occurs in two phases:
The total time to fill the cistern is given as 55 hours. Therefore:
$t_1 + t_2 = 55 \text{ hours}$
The total work done is filling 1 cistern. The work done is the sum of the work done by each pipe in its respective phase.
Combined rate in Phase 1 (A + C) = Rate(A) + Rate(C) = $\frac{1}{18} - \frac{1}{45} = \frac{5 - 2}{90} = \frac{3}{90} = \frac{1}{30}$ cistern/hour.
Combined rate in Phase 2 (B + C) = Rate(B) + Rate(C) = $\frac{1}{27} - \frac{1}{45} = \frac{5 - 3}{135} = \frac{2}{135}$ cistern/hour.
The total work equation is:
$(\text{Rate A + Rate C}) \times t_1 + (\text{Rate B + Rate C}) \times t_2 = 1$
$ \left( \frac{1}{30} \right) t_1 + \left( \frac{2}{135} \right) t_2 = 1 $
We know $t_1 = 55 - t_2$. Substitute this into the work equation:
$ \frac{1}{30} (55 - t_2) + \frac{2}{135} t_2 = 1 $
Multiply the equation by the Least Common Multiple (LCM) of the denominators (30 and 135), which is 270:
$ 270 \times \frac{1}{30} (55 - t_2) + 270 \times \frac{2}{135} t_2 = 270 \times 1 $
$ 9 (55 - t_2) + 2 \times 2 t_2 = 270 $
$ 495 - 9 t_2 + 4 t_2 = 270 $
$ 495 - 5 t_2 = 270 $
Rearrange to solve for $t_2$:
$ 5 t_2 = 495 - 270 $
$ 5 t_2 = 225 $
$ t_2 = \frac{225}{5} $
$ t_2 = 45 \text{ hours} $
Pipe B was turned on for 45 hours.
Pipe P can fill $\frac{2}{3}$ part of a tank in 16 hours, and pipe Q can fill $\frac{5}{6}$ part of the same tank in 20 hours. Both P and Q were kept open for 2 hours, then both were closed. Pipe R alone was then opened and it emptied the water in the tank in 8 hours. Pipes P, Q and R together can fill the empty tank in:
Pipe P can fill $\frac{2}{3}$ part of a tank in 24 hours, and pipe Q can fill $\frac{2}{3}$ part of the same tank in 16 hours. Both P and Q were kept open for 4 hours, then both were closed. Pipe R alone was then opened and it emptied the water in the tank in 5 hours. Pipes P, Q and R together can fill the empty tank in:
Pipe P can fill $\frac{3}{8}$ part of a tank in 21 hours and pipe Q can fill $\frac{2}{7}$ part of the same tank in 16 hours. Both P and Q were kept open for 2 hours, then both were closed. Pipe R alone was then opened and it emptied the water in the tank in 3 hours. Pipes P, Q and R together can fill the empty tank in: