当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5333:Undirected Graph

题目描述
As we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some math tasks to practice. There is one of them:

There is an undirected graph with $n$ vertices and $m$ edges. Then Yuta does $q$ operations on this graph. Each operation is described by two integers $L,R\ (1 \leq L \leq R \leq n)$ and can be split into three steps:

1. Delete all the edges which have at least one vertice outside the range $[L,R]$.

2. Yuta wants you to tell him the number of connected component of the graph.

3. Restore the graph.

This task is too hard for Rikka to solve. Can you help her?
输入解释
There are at most 100 testcases and there are at least 97 testcases with $n,m,q \leq 1000$.

For each testcase, the first line contains three numbers $n,m,q\ (n,q \leq 10^5, m \leq 2 \times 10^5)$.

Then $m$ lines follow. Each line contains two numbers $u_i,v_i\ (1 \leq u_i,v_i \leq 10^5)$ which describe an edge of the graph.

Then $q$ lines follows. Each line contains two numbers $L_i,R_i\ (1 \leq L \leq R \leq n)$ which describe an operation.
输出解释
For each operation you need print a single line with a single number - the answer of this operation.
输入样例
3 3 2
1 2
1 3
2 3
1 2
1 3
输出样例
2
1
来自杭电HDUOJ的附加信息
Author XJZX
Recommend wange2014

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-5333

最后修改于 2020-10-25T23:21:47+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
5000/2500MS(Java/Others) 65536/65536K(Java/Others)