当前位置:码农谷 > 算法与程序 > HDU 4496 D-City:题目解答源码

HDU 4496 D-City:题目解答源码

所属学科:C语言 - 位运算 难度: 关注度:58

Luxer is a really bad guy. He destroys everything he met.
One day Luxer went to D-city. D-city has N D-points and M D-lines. Each D-line connects exactly two D-points. Luxer will destroy all the D-lines. The mayor of D-city wants to know how many connected blocks of D-city left after Luxer destroying the first K D-lines in the input.
Two points are in the same connected blocks if and only if they connect to each other directly or indirectly.

输入描述

First line of the input contains two integers N and M.
Then following M lines each containing 2 space-separated integers u and v, which denotes an D-line.
Constraints:
0 < N <= 10000
0 < M <= 100000
0 <= u, v < N.

输出描述

Output M lines, the ith line is the answer after deleting the first i edges in the input.


程序源码

完整的源代码如下

#include "stdio.h"#include "string.h"#include "iostream"#include "algorithm"#include "vector"#include "queue"#include "set"#include "map"#include "string"#include "math.h"#include "stdlib.h"

关注微信,获得更多免费资源
关于我们   |   免责声明   |   联系我们   |   网站地图   |   HR交流群   |   学生交流群   |   教师交流群

码农谷   版权所有 © 2015-2017   湘ICP备16018319号-1