We were waiting several weeks tp setting this contest and hope the problem was good enough.

I will write the full editorial in the few next days, now some hints and short solutions exist here.

**hint1**

**hint1**

805C - Найти Амира / 804A - Найти Амира

**hint1**

**hint2**

805D - Минимальное число шагов / 804B - Минимальное число шагов

**hint1**

**hint2**

**hint3**

**hint4**

805E - Раскраска мороженого / 804C - Раскраска мороженого

**hint1**

**hint2**

**hint3**

There were some opinion about this sentence of the problem:

`Vertices which have the i-th (1 ≤ i ≤ m) type of ice cream form a connected subgraph.`

A subgraph *S* of a graph *G* is a graph whose set of vertices and set of edges are all subsets of *G*. And according to this definition, the subgraph can also be empty as a subset of vertices and edges.

A graph which is connected in the sense of a topological space, i.e., there is a path from any point to any other point in the graph. A graph that is not connected is said to be disconnected. This definition means that the null graph and singleton graph are considered connected, while empty graphs on 2 ≤ *n* nodes are disconnected.

All of these definitions were from valid articles and it seems more logical. How ever, I should apologize all of the participants because of bad sample tests when some of articles and books didn't accept my opinion.

805F - Матожидание диаметра дерева / 804D - Матожидание диаметра дерева

**hint1**

**hint2**

**hint1**