You are given an undirected chart with n vertices and m edges. Additionally, you are given an integer k. Find either a faction of size k or a non-void subset of vertices to such an extent that every vertex of this subset has essentially k neighbors in the subset. In case there
Correct answer will be upvoted else Multiple Downvoted. Don't submit random answer. Computer science.
You are given an undirected chart with n vertices and m edges. Additionally, you are given an integer k.
Find either a faction of size k or a non-void subset of vertices to such an extent that every vertex of this subset has essentially k neighbors in the subset. In case there are no such inner circles and subsets report about it.
A subset of vertices is known as a faction of size k if its size is k and there exists an edge between each two vertices from the subset. A vertex is known as a neighbor of the other vertex if there exists an edge between them.
Input
The primary line contains a solitary integer t (1≤t≤105) — the number of experiments. The following lines contain portrayals of experiments.
The principal line of the depiction of each experiment contains three integers n, m, k (1≤n,m,k≤105, k≤n).
Every one of the following m lines contains two integers u,v (1≤u,v≤n,u≠v), indicating an edge between vertices u and v.
It is ensured that there are no self-circles or various edges. It is ensured that the amount of n for all experiments and the amount of m for all experiments doesn't surpass 2⋅105.
Output
For each experiment:
In the event that you found a subset of vertices to such an extent that every vertex of this subset has basically k neighbors in the subset in the main line output 1 and the size of the subset. On the subsequent line output the vertices of the subset in any request.
In the event that you tracked down a coterie of size k, in the primary line output 2 and in the subsequent line output the vertices of the faction in any request.
In case there are no necessary subsets and factions print −1.
In the event that there exists numerous potential answers you can print any of them

Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 1 images









