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.
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"