Dima and Trap Graph CodeForces - 366D 并查集
思路: 一开始想用dfs来做,如果标记会忽略掉很多情况,如果不标记就会超时。 dfs是来模拟这个过程,可以用并查集来枚举,直接判断。
#include
#include
#include
using namespace std;
const int N = 1010;
int n,m;
const int M = 3030;
int f[N];
int find( int x )
原创
2017-03-12 16:40:05 ·
267 阅读 ·
0 评论