WEBISL - Web islands
For a given set of web pages, we want to find largest subsets such that from every page in a subset you can follow links to any other page in the same subset.
On the first line, there are two numbers, number of the pages N, and total number of links M. Pages are numbered from 0 up to N-1. On lines 2 up to M+1, there are two numbers per line. The first is the source page and the second is the target page of a link.
On N lines there is a component ID for every single page. The componet ID is the smallest page index on the component.
Input: 3 3
getting WA, someone give tough test case
Using STL gave TLE, even with fast input...
need more test cases. getting WA
plz explain with other test case..not able to understand.
Got AC with N = 100005
Got A.C assuming N < 10^7.
What is the range of N?
Need Help is answer for below case::