We have set of graph $$$G$$$ and 4 types of queries:
- Add/Remove set of direct edges $$$(uv)$$$.
- Mark vertex $$$v$$$.
- Check for some vertex $$$v$$$ if there is a path from marked vertex $$$u$$$ to $$$v$$$.
$$$N <= 1000000, M <= 10000000, queries <= 1000$$$ , Should be better $$$O(N^2)$$$, online.
There are no more than $$$1000$$$ edges in 1 query
I have no idea how to solve this, any hint?