Problem Q
Liftkarta
Languages
en
sv
The mountain Bergurbulgur consists of
Given the information about all families, all points, ans
ski slopes in Bergurbulgur, output for every family how many
family members that can travel from
Bergurbulgur is guaranteed to be a connected graph - which means that it is possible to get from every point to every other point on the mountain through some sequence of slopes and lifts. This means that a person with an infinite skill rating will always be able to reach every point.
Input
The first line contains three integers
Then follows
On the following
Output
Output for every family a new line with an integer, the
amount of family members in family
Points
Your solution will be tested on several test case groups. To
get the points for a group, it must pass all the test cases in
the group.
Group |
Point value |
Constraints |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
No further constraints. |
Explanation for sample 1
No matter how the first family chooses to get from point 6 to point 2 they have to go up the lift between 5 and 6, which has a difficulty rating of 7. This implies that only one family member can make it from point 6 to 2. For the second family they have to go through at least one slope or lift with a difficulty rating of 3, which means only 2 family members can make it from point 1 to point 4.
Sample Input 1 | Sample Output 1 |
---|---|
6 9 2 1 2 3 2 3 3 3 4 2 2 4 5 2 5 6 1 4 4 1 5 4 4 5 5 5 6 7 6 2 2 2 5 1 4 3 1 2 |
1 2 |