#CF191C. 傻瓜与道路(Fools and Roads)
0
傻瓜与道路(Fools and Roads)
傻瓜与道路(Fools and Roads)
题目描述
有一颗 个节点的树, 次旅行,问每一条边被走过的次数。
输入格式
第一行一个整数 ( )。
接下来 行,每行两个正整数 ( ),表示 与 之间有一条连边。
接下来一个整数 ( )。
接下来 行,每行两个正整数 ( ),表示有一个从 到 的旅行。
输出格式
一行空格分隔的 个整数,按输入顺序输出每一条边被走过的次数。
Translated by @larryzhong
样例输入 #1
5
1 2
1 3
2 4
2 5
2
1 4
3 5
样例输出 #1
2 1 1 1
样例输入 #2
5
3 4
4 5
1 4
2 4
3
2 3
1 3
3 5
样例输出 #2
3 1 1 1
数据范围
In the first sample the fool number one goes on the first and third road and the fool number goes on the second, first and fourth ones.
In the second sample, the fools number , and go on the first road, the fool number will go on the second road, on the third road goes the fool number , and on the fourth one goes fool number .
知识点与难度
本题涉及的知识点从属于 CSP-S,难度(CF Rating):1600。
测试点分布
| Subtask | 分值 | 测试点编号 | 说明 |
|---|---|---|---|
| 0 | 10 | 1~2 | 样例 |
| 1 | 25 | 3~8 | 小规模与边界测试数据 |
| 2 | 30 | 9~16 | 中等规模测试数据 |
| 3 | 35 | 17~25 | 满规模极限测试数据 |
出处:原题链接