#abc264e. E - Blackout 2
E - Blackout 2
Score : points
问题描述
一个国家拥有 座城市和 座发电厂,我们统称这些地方。
这些地方编号为 ,其中地方 是城市,地方 是发电厂。
该国拥有 条输电线路。第 条输电线路()双向连接地方 和地方 。
如果从一座城市出发,可以通过一些输电线路至少到达一座发电厂,则称这座城市已通电。
现在,将发生 个事件。在第 个事件()中,第 条输电线路断裂,变得无法使用。一旦输电线路断裂,在后续的事件中它将保持断裂状态。
找出每个事件发生后已通电城市的数量。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
A country has cities and power plants, which we collectively call places.
The places are numbered , among which Places are the cities and Places are the power plants.
This country has power lines. Power Line () connects Place and Place bidirectionally.
A city is said to be electrified if one can reach at least one of the power plants from the city using some power lines.
Now, events will happen. In the -th () event, Power Line breaks, making it unusable. Once a power line breaks, it remains broken in the succeeding events.
Find the number of electrified cities right after each events.
Constraints
- All values in input are integers.
- If , then or .
- are distinct.
Input
Input is given from Standard Input in the following format:
Output
Print lines.
The -th line should contain the number of electrified cities right after the -th event.
Sample Input 1
5 5 10
2 3
4 10
5 10
6 9
2 9
4 8
1 7
3 6
8 10
1 8
6
3
5
8
10
2
7
Sample Output 1
4
4
2
2
2
1
Initially, all cities are electrified.
- The -st event breaks Power Line that connects Point and Point .
- Now City is no longer electrified, while cities remain electrified.
- The -nd event breaks Power Line that connects Point and Point .
- The -rd event breaks Power Line that connects Point and Point .
- Now Cities and are no longer electrified, while cities remain electrified.
- The -th event breaks Power Line that connects Point and Point .
- The -th event breaks Power Line that connects Point and Point .
- The -th event breaks Power Line that connects Point and Point .
- Now City is no longer electrified, while city remains electrified.
update @ 2024/3/10 11:09:44