Independent Set
시간 제한1초메모리 제한2048 MB
정점 수열을 넣으면 각 정점마다 독립 집합에 이미 들어간 이웃의 수를 돌려주는 오라클을 이용해, 알려지지 않은 다중 그래프의 모든 간선을 찾아낸다.
문제
This is an interactive problem. You have to use the flush operation right after printing each line. For example, you can use the function fflush(stdout) for C or C++, System.out.flush() for Java, flush(output) for Pascal, and sys.stdout.flush() for Python.
An independent set in a graph is a set of vertices such that, for every two vertices in the set, there is no edge connecting them.
There is an algorithm to construct an independent set in the graph.
The algorithm receives a sequence of vertices. Suppose the sequence is . Initially, there is an empty set and a sequence that satisfies .
Then for from to :
- Look at every edge in the graph, and increment every time when the edge connects and a vertex in .
- If after searching, insert into .
Obviously, will be an independent set after the algorithm.
Now, you only know the number of vertices in the graph, and you want to find all its edges. There is an interactor to help you. The interactor receives a sequence of vertices, runs the algorithm above, and returns the sequence .
You want to achieve your goal with the total length of the sequences that you feed no more than .
Note that there may be multiple edges and self-loops in the graph.
입력
The first line contains a single integer , the number of vertices in the graph.
Suppose is the number of edges in the graph. It is guaranteed that and .