Description In the NN country, there are n cities, numbered from 1 to n, and n−1 roads, connecting them. There is a roads path between any two cities. There are m bidirectional bus routes between cities. Buses drive between two cities taking the shor…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Amr lives in Lala Land. Lala Land is a very beautiful country that is located on a coordinate line. Lala Land is famous with its apple trees grow…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output In the country there are n cities and m bidirectional roads between them. Each city has an army. Army of the i-th city consists of ai soldiers. N…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output The country Treeland consists of n cities connected with n - 1 bidirectional roads in such a way that it's possible to reach every city starting…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Ari the monster is not an ordinary monster. She is the hidden identity of Super M, the Byteforces' superhero. Byteforces is a country that consi…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Running with barriers on the circle track is very popular in the country where Dasha lives, so no wonder that on her way to classes she saw the…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Due to the increase in the number of students of Berland State University it was decided to equip a new computer room. You were given the task o…
E. Cyclic Components time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given an undirected graph consisting of nn vertices and mm edges. Your task is to find the number of connected…