#P8250. 交友问题

交友问题

Description

There are nn users on Luogu, and these users form an undirected network.

Luogu’s photo sharing rule is as follows: if user ii shares a photo with their friend jj, then all friends kk of jj can see this photo. User jj can also see this photo.

Now, user uiu_i wants to share a photo, but they do not want user viv_i to see it. Without sending it to themselves, they want to know the maximum number of friends they can send it to.

Input Format

The first line contains three positive integers n,m,qn, m, q, representing the number of users, the number of edges, and the number of queries.

The next mm lines each contain two numbers xi,yix_i, y_i, indicating that there is an undirected edge between users xix_i and yiy_i.

The next qq lines each contain two numbers ui,viu_i, v_i, indicating the ii-th query.

Output Format

For each query, output one line containing one number, the answer.

6 7 8
5 1
1 4
1 6
5 6
5 4
1 2
5 3
5 3
1 1
3 6
1 5
5 6
1 4
5 2
2 6
3
0
0
1
2
2
3
0

Hint

For 20%20\% of the testdata, 1n,q2×1031 \le n, q \le 2 \times 10^3, 1m8×1031 \le m \le 8 \times 10^3.

For 60%60\% of the testdata, 1n,q2×1041 \le n, q \le 2 \times 10^4, 1m5×1041 \le m \le 5 \times 10^4.

For 100%100\% of the testdata, 1n,q2×1051 \le n, q \le 2 \times 10^5, 1m7×1051 \le m \le 7 \times 10^5.

It is guaranteed that there are no multiple edges and no self-loops.

Translated by ChatGPT 5