# Editorial

Problem Author: | Illia Fursov, Maksym Shvedchenko, Illia Shevchenko |

Prepared by: | Illia Shevchenko, Illia Fursov |

Editorial by: | Illia Fursov |

Group 1: $a,b,c≤1$.

In this group, we do not need to think about the condition of having cubes of pairwise different colors, because there is at most one cube of every color. Thus, we can just check all the combinations of cubes that we can have in one set and add $1$ to the answer for every.

#include <bits/stdc++.h> using namespace std; int main() { int a, b, c; cin >> a >> b >> c; int ans = 0; if (a and b) // blue and yellow ans += 1; if (b and c) // yellow and green ans += 1; if (a and c) // blue and green ans += 1; if (a and b and c) // blue, yellow and green ans += 1; cout << ans << endl; }

Group 2. $b=0$, $c=0$.

Here, the only cubes we have are of blue color. There can be at most one cube of blue color in every set, thus there can be at most one cube in every set in total. But there have to be at least two. So, the answer here is always $0$.

Group 3. $c=0$.

The only colors here are blue and yellow, and both colors have to be in every set (because there can be at most two (both) of them, and there have to be at least two of them). The number of options to choose one cube is $a$ for blue color and $b$ for yellow (because the number on a cube matters). Every combination of cubes of two colors is different, so the answer for this group is $a⋅b$.

Group 4: $1≤a,b,c≤1000$ (no additional constraints).

There are (at least) two ways to fully solve the problem.

The first way is the same as in the first group, but now the number of combinations are not always $1$, but $a⋅b$, $b⋅c$, $a⋅c$ and $a⋅b⋅c$ for every combination of colors. So, the answer is a sum of these values: $a⋅b+b⋅c+a⋅c+a⋅b⋅c$.

The other way is to count all the combinations we can do (knowing that all the cubes have to be of different colors) and exclude the ones that include only one or no cubes. For blue color there are $a+1$ ways to choose or not to choose a cube. The similar is for yellow and green colors, so the total number of combinations is $(a+1)⋅(b+1)⋅(c+1)$. The number of ways to choose only one color is $a$, $b$ and $c$ for every color correspondingly (thus, $a+b+c$ in total). The number of ways to choose none of the cubes is only one — choose to not to take a cube for every color. So, the resulting answer is $(a+1)⋅(b+1)⋅(c+1)−(a+b+c+1)$, which is the same as in the first way.