摘要:
Link 我们可以将同一颜色的连通块缩成点。 然后我们就得到了一棵黑白相间的树。 树的直径的一半即为答案 ps:树的直径,先从随便一个点出发找到最远的点,再从最远的点走到这个点的最远的点,即为树的直径 #include <bits/stdc++.h> using namespace std ; co 阅读全文
摘要:
我们考虑分治一下 按$x$坐标排序 然后对于每一段的两部分都按$y$排序 左右两边都维护一个单调栈 然后考虑右边对左边的贡献就行了 #include <bits/stdc++.h> #define int long long using namespace std ; const int MAXN 阅读全文