当前位置: 代码迷 >> 综合 >> 强连通分量 CCF201509-4 高速公路
  详细解决方案

强连通分量 CCF201509-4 高速公路

热度:26   发布时间:2023-12-14 03:19:25.0

传送门:点击打开链接

题意:告诉有向图,求互通的城市对数。

思路:强连通分量裸题,求出所有的强连通分量,答案就等于sigma s[i]*(s[i]-1)/2,s[i]是每个强连通分量的大小

#include <map>
#include <set>
#include <cmath>
#include <ctime>
#include <Stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <bitset>
#include <string>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <functional>
#define fuck(x) cout << "[" << x << "]"
#define FIN freopen("input.txt", "r", stdin)
#define FOUT freopen("output.txt", "w+", stdout)
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;const int MX = 1e5 + 5;
const int INF &#