传统题 1000ms 256MiB

Building Point Pair

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

说明

Do you remember that when you first entered Fujian Normal University in your freshman year, the enthusiastic seniors and sisters gave you a gift package for the start of school. There is a map in the gift package. On the map, there are $n$ teaching buildings on the map. They are connected by $m$ undirected roads, the distance of each road is $1$.

Now You are given two integers $a, b$ which refers two special teaching buildings. Please find the total number of pairs $(u,v)$ of the teaching buildings to satisfy : Every path from $u$ to $v$ must go through two special teaching buildings $a$ and $b$.

输入格式

The first line contains four integers $n,m,a,b$ $(4 \leq n \leq m \leq 10^5, 1 \leq a,b \leq n,a \neq b)$.

The next $m$ lines contains two integers $u,v$ $(1\leq u,v \leq n, u \neq v)$, represent an edge between building $u$ and $v$.

输出格式

Print the total number of pairs that meets the conditions.

样例

7 7 2 3
1 2
2 3
3 4
4 5
5 6
4 6
2 7
6

福建师范大学第十八届程序设计竞赛正式赛

未参加
状态
已结束
规则
IOI
题目
10
开始于
2022-4-25 8:00
结束于
2023-3-24 16:00
持续时间
8000 小时
主持人
参赛人数
15