City's Happiness City's Happiness
RU English

Citizens of GridLand are sending emails to each other all the time. They send everything - what they just ate, a funny picture, questions or thoughts that are bothering them right now. All the citizens are happy because they have such a wonderful network that keeps them connected.

The main goal of the Mayor is to control the city's happiness. The city's happiness is a sum of all citizens' happiness. And the happiness of each citizen is equal to the number of citizens (always including oneself) that one can send emails to.

Because the city is growing, the citizens have decided that the Mayor needs an assistant to focus on the node protection.

Your mission is to figure out what will be the first nodes to investigate and protect for the new assistant. Remember, you should choose the most important node in the network. If several nodes have the maximal importance, find all of them

Input: Two arguments: the network structure (as a list of connections between the nodes), users on each node (as dict where keys are the node-names and values are the amounts of users).

Output: List of the most cruсial nodes.


    ['A', 'B'],
    ['B', 'C']
    'A': 10,
    'B': 10,
    'C': 10
}) == ['B']

    ['A', 'B']
    'A': 20,
    'B': 10
}) == ['A']

    ['A', 'B'],
    ['A', 'C'],
    ['A', 'D'],
    ['A', 'E']
    'A': 0,
    'B': 10,
    'C': 10,
    'D': 10,
    'E': 10
}) == ['A']

    ['A', 'B'],
    ['B', 'C'],
    ['C', 'D']
    'A': 10,
    'B': 20,
    'C': 10,
    'D': 20
}) == ['B']
CheckiO Extensions

CheckiO Extensions allow you to use local files to solve missions. More info in a blog post.

In order to install CheckiO client you'll need installed Python (version at least 3.8)

Install CheckiO Client first:

pip3 install checkio_client

Configure your tool

checkio --domain=py config --key=

Sync solutions into your local folder

checkio sync

(in beta testing) Launch local server so your browser can use it and sync solution between local file end extension on the fly. (doesn't work for safari)

checkio serv -d

Alternatevly, you can install Chrome extension or FF addon

checkio install-plugin
checkio install-plugin --ff
checkio install-plugin --chromium

Read more here about other functionality that the checkio client provides. Feel free to submit an issue in case of any difficulties.

<< <
> >>
exec show

Whats Next?

Use Promo Code HAPPY2022 before February 1st to buy One Year Awesome with a 40% discount.
Let's make the year 2022 - the year of code.
Free accounts will see Best CheckiO solutions with some delay.
Best Solutions will be opened in
Become Awesome and Don't wait
The next stage is ""
Will be activated in
View More Solutions Random Review Solutions Share your own solution
Go to the next mission