Pipe P can fill a cistern in 24 minutes

So in 1 minute, P fills : 1/24 part of the tank [Time proportional to Work, when the time decreases, the amount of work also decreases]

Pipe Q can fill the cistern in 32 minutes

So in 1 minute, Q fills : 1/32 part of the tank.

The cistern has to be filled in 16 minutes. [we have to find when the first pipe should be closed so that cistern is full in 16 minutes.]

So Pipe Q is open for the whole time, 16 minutes.

In 16 minutes Pipe Q fills : 16 * 1/32 = 1/2 part of the tank.

Remaining part = 1 - 1/2 = 1/2 part.

This has to be filled by pipe P

1 min == 1/24 part

X mins == 1/2 part

X/24 = 1/2

X = 24/2 = 12 minutes.

Hence pipe P has to be closed after 12 minutes, so that the cistern will be full in 16 minutes.

[pipe P and Q works for 12 minutes, then for the next 4 minutes pipe Q alone works]

Hope it helps.