| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2.5 초 | 2048 MB | 121 | 49 | 39 | 50.649% |
You are given an undirected graph with $N$ vertices and $M$ edges, with vertices numbered from $1$ to $N$.
You have to select two integers $p$ and $q$ such that:
You have to find $p$, $q$, along with any $S_1$ and $S_2$ that satisfy the requirements above. It can be proven that such $p$ and $q$ always exist.
The first line contains two integers $N$ and $M$ ($1 \leq N \leq 2000$; $0 \leq M \leq \min(\frac{N(N-1)}{2}, 200000$)). Each of the next $M$ lines contains two integers $u$ and $v$ ($1 \leq u < v \leq N$) representing the two vertex numbers that are connected by an edge. All the given edges are different.
The first line contains two integers $p$ and $q$. The second line contains an integer $|S_1|$ followed by $|S_1|$ integers representing the vertex numbers in $S_1$. The third line contains an integer $|S_2|$ followed by $|S_2|$ integers representing the vertex numbers in $S_2$.
4 2 1 2 3 4
1 2 2 1 2 2 3 1
Explanation of Sample 1: You selected $p = 1$, $q = 2$, $S_1 = \{1, 2\}$, and $S_2 = \{1, 3\}$.