摘要:
思路:搞人的题,特判0 0 的时候 输出 "is a tree.", 存在回路的时候 输出 "is not a tree.", 存在两个联通分量的时候输出 "is not a tree."。也就是两个树的时候。 两个树要怎么判断呢 假设给出的所有的边,组成一棵树,利用并查集我们可以把他所有的子节点并 阅读全文
摘要:
题意: 两个车相向而行,初始速度为1 ,当到达 a[i] 的位置的时候,速度就会+1,问什么时候回相遇 思虑:二分查找时间。 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=2e5+10; 阅读全文
摘要:
转载: https://blog.csdn.net/obsorb_knowledge/article/details/81168166 感觉比向量的好理解。。。 #include<stdio.h> const int maxn = 200005; int f[maxn], val[maxn]; in 阅读全文