10 2019 档案
摘要:#include<cstring> #include<iostream> #include<cstdio> #include<queue> #include<algorithm> #define maxn 200200 using namespace std; typedef long long ll; int par[maxn]; ll num[maxn]; int find(int x) {
阅读全文
摘要:周末牛客挂了个更难的,这个简单一些
阅读全文
摘要:#include #include #include #include #include #define maxn 5000100 using namespace std; typedef long long ll; ll tree[maxn]; ll arr[maxn]; int vis[maxn]; int root = 1; int push_down(int node, int...
阅读全文
摘要:刚开始想了两个小时,打算把区间分块然后计算,但是这就很灵性了看了一个大佬的博客,侵删
阅读全文
摘要:按照《算法竞赛进阶指南》写的 哦对了,注意下最后判断,因为开始拓扑的时候,s可能不在里边,所以不一定等于INF,而是应该大于等于INF
阅读全文
摘要:典型树上dp,直接暴力算会超时,小心呀
阅读全文
摘要:#include<iostream> #include<cstring> #include<cstdio> #include<algorithm> #include<queue> #include<vector> #define maxn 300100 using namespace std; const int N = 110; const int base = 20010; int n, k,
阅读全文
摘要:#include #include #include #include using namespace std; typedef long long ll; ll list[200010]; ll ans[200010]; ll g[200010]; ll f[200010]; int n,c; int main(){ scanf("%d %d",&n,&c); for(int i...
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/959/H来源:牛客网 C国有n个大城市和m条道路,每条道路连接这n个城市中的某两个城市。任意两个城市之间最多只有一条道路直接相连。这m条道路中有一部分为单向通行的道路,一部分为双向通行的道路,双向通行的道路在统计条数时也
阅读全文
摘要:二分+最短路算法
阅读全文
摘要:#include<cstdio> #include<iostream> #include<cstring> #include<algorithm> #include<vector> #define maxn 2100 using namespace std; vector<int>G[maxn]; void insert(int be, int en) { G[be].push_back(en);
阅读全文
摘要:#include<cstring> #include<iostream> #include<cstring> #include<queue> #include<vector> #define maxn 100010 using namespace std; const long long mod = 1000000000 + 7; typedef long long ll; int de[maxn
阅读全文
摘要:我想说说双联通分量还有割点和桥 1.割点(一个点,如果没有这一个点,图就会变得不连通) 2.桥(一条边,断开这条边就会让图不连通) 3.点双连通(没割点的图) 4.边双连通(没桥的图) 5.割点之间不一定有桥!!! 6.桥两端不一定是割点!!! 对了,关于tarjan我还想再说说 就像下图,圈住的是
阅读全文
摘要:传送门 https://ac.nowcoder.com/acm/contest/1109#question 刚开始吓得我以为要搞树分治,差点就捞了哦! 这个定理要铭记于心啊!!!
阅读全文
摘要:这道题挺难的,可以加深对割点的理解,还有,排列组合好重要了,分连通块,然后乘法原理(加法原理计数什么的) 传送门 https://www.luogu.org/problem/P3225 省选oi题好难啊QAQ
阅读全文