上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 31 下一页
摘要: 题目 Code #include<bits/stdc++.h> using namespace std; const int N=200002; struct node{ int to,ne,w; }e[N<<1]; int h[N],sum,mx[N],sz[N],dis[N],rem[N],to 阅读全文
posted @ 2019-03-04 20:29 Mingoal 阅读(15) 评论(0) 推荐(0)
摘要: 题目 不难发现树上的路径分为两类, 经过根节点 r t rt rt的路径和包含于 r t rt rt的某棵子树里(不经过 r t rt rt)的 对于前者, 我们用 d i s [ u ] dis[u] dis[u]表示结点u到根节点 r t rt rt的路径长度, 则 u u u到 v v v的路 阅读全文
posted @ 2019-03-04 15:40 Mingoal 阅读(30) 评论(0) 推荐(0)
摘要: 题目 Solution 这题做着挺顺,我就按我的心路历程讲下去好了 先请大家搞清楚颜色数和颜色的个数,不然看下去会觉得我讲得很奇怪 假设 m x = m a x { a i } , m n = m i n { a i } mx=max\lbrace a_i\rbrace,mn=min\lbrace 阅读全文
posted @ 2019-03-04 10:43 Mingoal 阅读(26) 评论(0) 推荐(0)
摘要: 题目 题解 Code #include<bits/stdc++.h> using namespace std; const int N=4000002,inv2=500000004,inv6=166666668,M=1e9+7; int a,b,v[255],i,j,cnt,phi[N],pr[N/ 阅读全文
posted @ 2019-02-28 11:24 Mingoal 阅读(23) 评论(0) 推荐(0)
摘要: 题目 题解 阅读全文
posted @ 2019-02-27 18:18 Mingoal 阅读(19) 评论(0) 推荐(0)
摘要: 题目 题解 Code #include<bits/stdc++.h> using namespace std; const int N=1000002; struct node{ int to,ne; }e[N<<1]; int sz[N],x,y,tot,h[N],num[N],n,i,cnt,a 阅读全文
posted @ 2019-02-26 14:41 Mingoal 阅读(35) 评论(0) 推荐(0)
摘要: 题目 题解 数组大小要好好算算 Code #include<bits/stdc++.h> #include<ext/pb_ds/priority_queue.hpp> using namespace std; using namespace __gnu_pbds; typedef long long 阅读全文
posted @ 2019-02-26 14:23 Mingoal 阅读(26) 评论(0) 推荐(0)
摘要: 题目 题解 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=100002; struct node{ int to,ne; }e[N<<1]; int n,i,x,y,tot,dep[N], 阅读全文
posted @ 2019-02-25 16:01 Mingoal 阅读(36) 评论(0) 推荐(0)
摘要: 题目 Solution 显而易见的是,两个同色点的 l c a lca lca一定和这两个点划分在一棵树内,若 l c a lca lca已经染色且颜色与这两点不同,那么答案很明显是 0 0 0 然后设计 d p dp dp方程 f [ u ] [ 0 / 1 ] f[u][0/1] f[u][0/ 阅读全文
posted @ 2019-02-22 11:40 Mingoal 阅读(20) 评论(0) 推荐(0)
摘要: 题目 #include<bits/stdc++.h> using namespace std; #define mid (l+r>>1) const int N=100002,M=3000002; struct seg{ int l,r,id; }a[M]; struct kd{ int l,r,m 阅读全文
posted @ 2019-02-21 09:43 Mingoal 阅读(26) 评论(0) 推荐(0)
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 31 下一页