上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 36 下一页
摘要: 先求一发 scc 然后缩点,然后根据入度出度为 $0$ 的点的个数乱搞。 cpp include include include using namespace std; int T, n, m, hea[20005], cnt, uu, vv, bel[20005], scc, din, sta[ 阅读全文
posted @ 2018-03-16 19:11 poorpool 阅读(106) 评论(0) 推荐(0)
摘要: 二分一下,然后从左到右扫描,扫到左端点就把区间 push 到堆里。 每次有点不符合二分的值时,就贪心地选择右端点最远的 add。 阅读全文
posted @ 2018-03-16 15:44 poorpool 阅读(382) 评论(0) 推荐(0)
摘要: 分块+权值逆序对 阅读全文
posted @ 2018-03-16 14:33 poorpool 阅读(148) 评论(0) 推荐(0)
摘要: 看 "这里" cpp include include include using namespace std; int n, s[100005], a[100005], c[2][1000005], ans; int lb(int x){ return x& x; } void add(int x, 阅读全文
posted @ 2018-03-15 20:07 poorpool 阅读(117) 评论(0) 推荐(0)
摘要: 水题 cpp include include include using namespace std; typedef long long ll; int n, m, p, cnt[105], pri[2000005], ppp, ans=0; const int mod=20170408; boo 阅读全文
posted @ 2018-03-15 18:33 poorpool 阅读(115) 评论(0) 推荐(0)
摘要: 扫描线水题。 cpp include include include using namespace std; typedef long long ll; int n, m, dx[300005], dy[300005], cntx, cnty, cnt, uu, vv, ww, aa, bb; l 阅读全文
posted @ 2018-03-15 16:42 poorpool 阅读(224) 评论(0) 推荐(0)
摘要: 重点是求树的直径、半径。 参考 "这里" cpp include include include using namespace std; int n, uu[5005], vv[5005], ww[5005], cnt, hea[5005], zui[5005], cii[5005], dis; 阅读全文
posted @ 2018-03-15 16:00 poorpool 阅读(117) 评论(0) 推荐(0)
摘要: 最长链是根节点到深度最深的结点的路径。 显然,要么直接走最长链,要么兜兜转转几个圈圈再走最长链,而最长链以外的结点因为要“兜圈”,所以要经过两次。 cpp include include using namespace std; int n, v, hea[105], cnt, uu, vv, zc 阅读全文
posted @ 2018-03-15 10:50 poorpool 阅读(180) 评论(0) 推荐(0)
摘要: 对于一个在位置 $i$ 的数,他等于 $i^k+sum_{1,k 1}$。 二项式定理推 $i^k$,矩阵快速幂即可。 cpp include include using namespace std; typedef long long ll; int k, c[15][15]; ll n; con 阅读全文
posted @ 2018-03-15 09:40 poorpool 阅读(313) 评论(0) 推荐(0)
摘要: 记 $f_i$ 是从要做 $i$ 步好操作变成要做 $i 1$ 步好操作的期望操作次数。 显然 $f_i=i/n \times 1 + (1 i/n) \times (1 + f_{i+1}+f_i)$,即 $f_i=(n+(n i)f_{i+1})/i$。$f_n=1$。 递推即可。 cpp in 阅读全文
posted @ 2018-03-15 09:03 poorpool 阅读(293) 评论(0) 推荐(0)
上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 36 下一页