In the city XYZ, P is a water source from where water flows into the tanks – Q, R, S, T and U. The following diagram shows the network of the source and all the five tanks connected with pipes through which water flows.

Diagram: Network of source and the 5 tanks

For any pipe, flow is the number of units of water flowing through it. For any tank, capacity is the number of units of water that the tank holds.

The following information is also known.

  1. The capacity (in units) of each of the five tanks given as well as the flow (in units) in each of the nine pipelines given is positive integral value less than 10.
  2. The flow (in units) of each of the pipelines connected to any tank is different except for the pipeline connecting Q and S. Further, none of them is equal to capacity (in units) of that tank.
  3. The difference in the capacities of R and T is 1 unit.
  4. The capacity of Q is more than that of exactly two tanks.
  5. The sum of the capacities of all the five tanks is 17 units.
  6. The flow in the pipeline connecting Q and T is 4 units and the flow in the pipeline connecting T and U is 2 units.
  7. U has the highest capacity.

Find the capacity of U.

  • (A) 5 units
  • (B) 6 units
  • (C) 7 units
  • (D) Cannot be determined

The answer given says:

Option D

But I was getting different answer (please check my answer post) which I think is right. Kindly help in figuring out which option is correct.

If you're interested in more questions on same problem then read further (they aren't a part of my doubt):

Q1: Find the flow in the pipeline connecting R to Q.

  • (A) 1 unit
  • (B) 2 units
  • (C) 3 units
  • (D) Cannot be determined

Q2: Find the flow in the pipeline connecting R to T.

  • (A) 5 units
  • (B) 6 units
  • (C) 7 units
  • (D) Cannot be determined

Q3: Find the combined capacity of the two tanks S and U.

  • (A) 9 units
  • (B) 10 units
  • (C) 11 units
  • (D) Cannot be determined

Their answers:

Q1: A

Q2: B

Q3: D

[The problem is from a textbook called 1002105 (belonging to some local institution)]

  • 7
    $\begingroup$ "The flow (in units) of each of the pipelines connected to any tank is different except for the pipeline connecting Q and S." What does this mean? What is the flow of the pipeline connecting Q and S the same as? $\endgroup$
    – SQLnoob
    Commented Jun 30, 2022 at 18:59
  • $\begingroup$ Is the direction of the arrows important? Must the sum of the flow in equal the sum of the flow out? $\endgroup$
    – Florian F
    Commented Jun 30, 2022 at 21:33
  • $\begingroup$ @SQLnoob, that statement means that the flow in pipeline QS can be equal to the flow in any other of the pipelines, that is QS may be equal to PQ, PR, RQ, QS, QT, RT, TS, SU or TU. Ignoring QS all the other mentioned pipelines have different flows. $\endgroup$ Commented Jul 1, 2022 at 3:50
  • $\begingroup$ @FlorianF the arrows show the direction in which water flows through the pipe. For example, water flows from tank R to tank Q but not vice-versa. Yes, Flow IN = Tank Capacity + Flow Out $\endgroup$ Commented Jul 1, 2022 at 3:54
  • 1
    $\begingroup$ Commented on your answer, but I'll ask here as well. Where do you get "Flow IN = Tank Capacity + Flow Out" from? It isn't stated explicitly, and isn't derivable from the given information. Without it, there are hundreds of possible solutions, but it seems like quite a big assumption to make. $\endgroup$
    – fljx
    Commented Jul 1, 2022 at 11:05

4 Answers 4


Given the conditions (assuming tank capacity is unique, which is not actually specified, now that I go back and look), the only tank capacities available totalling 17 are 1, 2, 3, 4, 7 and 1, 2, 3, 5, 6.

Given that Q has a higher capacity than exactly 2 other tanks, Q has a capacity of 3. The difference in capacity between R and T is 1, meaning that R and T have capacities of either 1 and 2, or 5 and 6. It can't be 5 and 6, since U has the highest capacity, so R and T must be 1 and 2.

This leaves U as either 6 or 7, but so far no indication of which.

The answer to question 3 (total of S and U) is not D, however, since either U is 7 (leaving S to be 4), or U is 6 (leaving S to be 5), the total is C (11 units).

This entire answer may be wrong if the assumption of different tank levels is incorrect.

  • $\begingroup$ I think the condition of different flows in pipelines isn't met in one of the cases (when U is 6). Please check. $\endgroup$ Commented Jul 1, 2022 at 8:12
  • $\begingroup$ Also, you needn't assume different tank levels, you'll arrive at same results inspite of it. The cases where tanks have same level will ultimately come out to be incoherent with respect to the conditions given. $\endgroup$ Commented Jul 1, 2022 at 8:14

Maybe this is a more clean analysis to build upon:

1. We will show $Q$ is $3$. $Q$ must be greater than two tanks, so it is not $1$. If it was $2$, there would be two tanks that are $1$. One of these is $R$ or $T$, so the other of $R$ or $T$ must be $2$ (since $R$ and $T$ differ by $1$) and we have four tanks totaling $6$ which would force the last tank to be $11$ which is too large. $Q$ cannot be $4$ because we are given $QT$ is $4$ (violating condition 2). If $Q$ was $5$ or more, the three largest tanks are at least $15$, so the only vaguely plausible arrangement is $(1, 1, 5, 5, 5)$ which doesn't admit an $R$ and $T$ that are one apart. (Or, this is more obvious if $U$ must be a strict maximum, but we don't need to assume that.) Thus, $Q$ is $3$.

2. We will show $R$ is $2$ and $T$ is $1$ or $3$. Two of $R$, $S$, and $T$ are less that $Q = 3$, so at least one of $R$ and $T$ is less than $3$. The other of $R$ and $T$ is then no greater than $3$ because $R$ and $T$ are one apart. Because $R$ and $T$ are one apart, one of them must be even and the other odd; $2$ is the only even number allowed, so one of them is $2$. $T$ cannot be two because we are given $TU$ is $2$, violating condition $2$. Thus, $R$ is $2$ and $T$ is $1$ or $3$.

3. We will resolve the left half of the diagram. The total flow out from the source must equal the sum of the capacities, $17$. Thus, $PQ$ and $PR$ are $8$ and $9$ (in some order) because they must sum to $17$. Then, consider the cut across pipelines $QS$, $QT$, and $RT$. Because we know the total flow is $17$, we can find the flow across this cut by subtracting out what is stored in $Q$ and $R$; so the flow across this cut is $12$. We are given $QT$ is $4$, so $QS + RT = 8$. The total flow into $Q$ is at least $9$, and we know it stores $3$ and outputs $4$ via $QT$, so $QS$ is at least $2$. $QS$ cannot be $3$ because that violates condition 2 at $Q$; it cannot be $4$ because then $RT$ is also $4$ and then $QT$ and $RT$ violate condition 2; it cannot be $5$ because then $RQ$ is $3$ or $4$, either violating condition 2; it cannot be $6$ because then $RT$ is $2$, violating condition 2; it cannot be $7$ because then $RT$ is $1$ which by condition 2 forces $T$ to be $3$, but then the flow into $T$ is only $5$ total which is already absorbed by $T$'s capacity and $TU$ without considering $TS$. Thus, $QS = 2$ and $RT = 6$. Then considering the net flows on $Q$, we see there must be only $9$ total flowing in, so $PQ = 8$ and $RQ = 1$. This leaves $PR = 9$ as well.

Now we must revisit condition 2.

The flow (in units) of each of the pipelines connected to any tank is different except for the pipeline connecting Q and S. Further, none of them is equal to capacity (in units) of that tank.

I interpret condition 2 to only restrict two pipelines if they share a tank. (All uses of condition 2 up to this point have fallen under this case.) I think you have interpreted it to mean that restrict any two pipelines regardless of whether they share a tank. (In either case, excluding $QS$, although worth noting that under my interpretation, the $QS$ exclusion doesn't allow any additional solution; but maybe it is meant to force a different analysis for some step.)

4. If $T = 3$, then there must be another tank less than $3$, so $S$ is $1$ or $2$; but $2$ conflicts with $QS = 2$, so $S = 1$ and $U = 8$. The rest can be resolved trivially just via the flow relation at each tank. Under my interpretation, this is an admissible solution, but $RT = SU = 6$, so I think you would reject it. Note that in this solution, $S + U = 9$ which has some relevance to Q3. (Surely if you believe there is a unique solution to the network, you disagree that $S + U$ is ambiguous.)

5. If $T = 1$, then $S + U = 11$. $U$ is at most $9$. If $U$ is $9$, then $S$ is $2$ which violated condition 2 because $QS = 2$. If $U$ is $8$, we get a solution that is admissible under my interpretation, but you would reject it because $RT = SU = 6$. If $U$ is $7$, we get your solution which I believe is unique under your interpretation. If $U$ is $6$, we get another solution that is admissible under my interpretation, but you would reject it because $QT = SU = 4$. If $U$ is less than $6$, then it is not greater than $S$, violating condition 7.

Diagram of solution(s):

enter image description here

  • $\begingroup$ Thank a lot for your answer, nice way to look at it, upvoted, but "The flow of each of the pipelines connected to any tank is different": because of "any", I think it should be interpreted that no 2 pipelines can have the same flow. For your assumption to work "same" word would have been mentioned. Without the use of that or some similar word, I think the assumption is too big (or far-fetched) to be made. But, you have also mentioned that without some relaxations in the assumption I made we can't have more solutions so that answers my primary concern, thank you. $\endgroup$ Commented Jul 2, 2022 at 4:41

We have following pipelines: PQ, PR, QS, QT, RT, RQ, TS, SU, and TU. So, instead of saying flow in pipeline PQ, I'll write PQ instead.

We have 5 tanks: Q, R, S, T, U. So, instead of saying capacity of tank Q, I'll write Q instead.

Using: U has greatest capacity, and (Q) $>$ (Exactly 2 tanks) then

Ranking tanks' capacities (higher capacity, higher rank):

  1. U
  2. Q

R and T have difference of exactly 1 unit so they have to be in positions 4 and 5. Note: S can't be in position 4 as Q's capacity is strictly greater than that of 2 tanks. Possibility of S being in position 5 will be probed at the end.

Thus, ranks obtained are:

  1. U (highest capacity)
  2. S (only place left for S)
  3. Q (greater than exactly 2)
  4. R or T
  5. T or R

Also, $T(or R) + R(or T) + Q + S + U = 17$

So, possibilities:

  1. $1+2+3+3+8$ respectively
  2. $1+2+3+4+7$ respectively
  3. $1+2+3+5+6$ respectively
  4. $1+2+4+4+6$ respectively

TU has flow of $2$ (given) so T can't be $2$ (condition 2).

So, $T=1$, $R=2$, $(Q,S,U) = [(3,3,8),(3,4,7),(3,5,6),(4,4,6)]$

Also, Total tanks capacity is to be met by the source P which means the total tanks' capacities ($=17$ units) will be met by PQ and PR, so they'll have flow of $8$ and $9$ (in any order).

Now consider the following diagram thus, obtained:

In process

Here, I have assumed RT $=x$, so, TS $= x+1$ as Flow In = Tank Capacity + Flow Out (let's call it the principle of water conservation).

So, $RT+QT=T+TU+TS \implies x+4=1+2+TS \implies TS=x+1$

Also, let U be $k$, then per principle, SU will be $k-2$. And, since QT $=4$ so, $k-2 \neq 4 \implies k \neq 6$. So possibility 3 and 4 are ruled out. So, U can be $k=7$ or $8 \implies k-2 = 5$ or $6$.

Now, let's check the values $x$ can assume.

It can't be $1,2,3,4,7,8$ or $9$ as condition 2 will be violated (via $x$ or $x+1$).

Also, if $x=5$, then $k$ won't be able to assume any values. So, $x=6$.

This also means that now $k-2 \neq 6 \implies k \neq 8$. Thus, U or $k=7$ is the only possibility, i.e. possibility 2 is correct and the rest are invalid.

At this point, keeping the principle in mind, we'll finally arrive at follows:


Thus, $Q=3$,$R=2$,$S=4$,$T=1$,$U=7$ and $PQ=8$,$PR=9$,$QS=2$,$RQ=1$,$QT=4$,$RT=6$,$TS=7$,$SU=5$,$TU=2 \rightarrow$ IS THE FINAL ANSWER

Also, when we assume $S=1$ and $(Q, R(or T), T(or R),U)=[(2,3,3,8),(3,4,4,5)]$ and proceeding in similar manner as above, we'll be finding ourselves violating condition 2. Thus, invalid.

So, the capacity of U is 7 units, that is, answer is Option (C).


Thanks to fljx for pointing out the the following possibility which I missed: $(Q,R,S,T,U)=(3,2,2,3,7)$.

(Proceeding in similar manner as above) We'll ultimately find ourselves violating the condition 1 in this case and thus the possibility is invalid.

  • $\begingroup$ Am I wrong somewhere? If you think my working is correct, please comment then too. $\endgroup$ Commented Jul 1, 2022 at 10:06
  • 1
    $\begingroup$ Where do you get "Flow In = Tank Capacity + Flow Out" from? It is assuming that all the tanks will be full after all the water has flowed, but I can't see that requirement anywhere in the original question. $\endgroup$
    – fljx
    Commented Jul 1, 2022 at 10:54
  • $\begingroup$ And, how do you exclude S being the smallest tank? (Your line at the end mentioning S=1 doesn't cover possibilities like 7,3,3,2,2 that aren't in your list.) $\endgroup$
    – fljx
    Commented Jul 1, 2022 at 11:02
  • $\begingroup$ @fljx thank you for pointing that out, I missed that possibility. I tried that possibility and it comes out invalid as well so it doesn't change anything. Hope you now agree with my working. Also, I have edited the answer. $\endgroup$ Commented Jul 1, 2022 at 12:03
  • 1
    $\begingroup$ Okay, I think there may be a disagreement about interpretation of condition 2. I think you have interpreted to mean no two pipelines can have the same flow (unless one of them is QS); but I think maybe it means no two pipelines connected to the same tank can have the same flow (unless one of them is QS). This creates additional solutions. Also maybe possible is that 0 is allowed as a positive integer (which is not usual, but sometimes it is defined as such). Without relaxing some condition, I'm not sure there are other answers. $\endgroup$
    – tehtmi
    Commented Jul 1, 2022 at 23:58

Here is the solution I found with the following assumptions:

  • The sizes of the tanks are all different
  • sum(flow in) = sum(flow out)

The idea is that the flow is permanent. In the long term the tank capacity shouldn't matter. It would be different with a water consumer.

In my interpretation the tank capacities are there only to provide constraints to work around.

Tank capacities

As others noted there are only two ways to get a total tank capacity of 17: 1+2+3+5+6 and 1+2+3+4+7. Q being larger than 2 other, we must have Q = 3. U is the largest, U = 6 or 7. R and T are one apart, they must be 1 and 2 in some order. But TU (flow from T to U) is 2, so R = 2, T = 1.

In summary Q = 3, R = 2, S = 4 or 5, T = 1, U = 7 or 6.


We are given QT=4, TU=2.

SU <= 9 so TS <= 8.

RT cannot be 1 or 2, it must be at least 3. RT+4 = TS+2, TS <= 8 so RT <= 6. RT is in 3..6. But RT cannot be 4, so RT is in (3,5,6). The corresonding possible values of TS are (5,7,8).

TS >= 5 and ST <= 9, so QS <= 4. But not 3. So QS in (1,2,4).

If QS is 4, TS, which so far is in (5,7,8), cannot be 7 or 8 because QS+TS = SU <= 9. That leave TS=5. But if QS=4 and TS=5, S cannot be 4 or 5. Therefore QS is not 4. QS is in (1,2).

RT >= 3 and PR <= 9, so RQ <= 6. But 2,3,4 are forbidden. RQ is in (1,5,6).

If QS is 1, out(Q) = 5, RQ cannot be 5 or 6, RQ is 1. But then PQ+RQ=QT+QS says PQ=4, which conflicts with QT. Therefore QS is not 1. QS is 2.

TS, so far in (5,7,8), cannot be 8 because TS+QS = SU <= 9. So TS is in (5,7).

If TS is 5, (S,U) cannot be (5,6), it must be (4,7). But SU = QS+TS = 2+5 = 7. SU conflicts with U. Therefore TS is not 5. TS is 7.

TS = 7, so SU = TS+QS = 9 and RT = TS-2 = 5.

RQ, so far in (1,5,6) cannot be 5 because of RT and cannot be 6 because it must be < QS+QT = 6. So, RQ = 1.

This solves all flows. PR=6, PQ=5, RQ=1, RT=5, QT=4, QS=2, TS=7, TU=2, SU=9.


Since these answers do not match the answers given in the hint, the initial assumption that sum(flow in) = sum(flow out) appears to be wrong.

  • $\begingroup$ Your assumption: Flow in = Flow out is flawed. Correct assumption is Flow in = Tank Capacity + Flow Out. Consider it this way, a glass of water upon drinking it full will be accounted by the amount the body absorbs and the amount the body does not use and thus passed off as waste for body. So, your final result clearly has 2 problems: 1. PR + PQ = 11 only but that means source only supplies 11 units of water while 17 units is needed. 2. Capacity of the tank U is just 6 or 7 units but SU + TU = 11 units, which is way more than tank can hold (ignoring the fact that this much can't reach either). $\endgroup$ Commented Jul 3, 2022 at 12:22
  • 2
    $\begingroup$ I beg to differ. In a city the water flows continuously. If the flow in is larger than the flow out, soon enough the tank fills up. What happens when the tank is full? As long as the problem doesn't state how the flows and the capacities work together my assumptions are just as legit as yours. If anything is flawed, it is the problem statement. $\endgroup$
    – Florian F
    Commented Jul 3, 2022 at 12:38
  • $\begingroup$ Maybe you are right too. Though still I think if it were your case, then the question would have also shown some pipeline moving out of tank U too. But I get the confusion. $\endgroup$ Commented Jul 3, 2022 at 13:09
  • $\begingroup$ I have to admit you've got a point there. Tank U having no pipe out is a problem. So ok, my assumption is flawed. $\endgroup$
    – Florian F
    Commented Jul 3, 2022 at 13:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.