感受巨水@_@ 思路最开始的思路比较暴力,直接从s出发然后干掉距离小于等于1的点,对于剩下的点构成很多连通块,我们只需求所有连通块的最大独立集合的和即可。有点懒,然后就用DP实现了。 #include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 500000 + 10; struct edge{ int v, nex; }e[maxn << 1]; int n, head[maxn], cnt, s, dp[maxn][2]; voi...