上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 14 下一页
摘要: 题目大意 给定一个 \(n\) 个点 \(m\) 条边的无向连通图,给每条边定向,使得生成的有向图是强连通图,若不可能,输出0。$2\leq n\leq 105,n-1\leq m\leq 3\times 105$。 题解 如果原图有桥,显然给每条边定向后不可能强连通。考虑原图的DFS树,不妨令所有 阅读全文
posted @ 2020-08-24 13:33 AE酱 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 参考了这篇文章,以及《算法导论》. 本文代码中图的定义: struct Graph{ struct edge{int Next,to;}; edge G[200010]; int head[10010]; int cnt; Graph():cnt(2){} void clear(int node_n 阅读全文
posted @ 2020-08-23 23:16 AE酱 阅读(442) 评论(0) 推荐(3) 编辑
摘要: 题目链接 记录一下,不详细写了,这道题的插头只需要二进制就够了。 Code #include <iostream> #include <algorithm> #include <cstring> #include <string> #include <cstdio> #include <vector 阅读全文
posted @ 2020-08-22 22:14 AE酱 阅读(97) 评论(0) 推荐(0) 编辑
摘要: 题目大意 给定全集 \(S,|S|=21\),然后给出 \(n(1\leq n\leq 10^6)\) 个 \(S\) 的子集 \(P_i\),以及每个子集的价值 \(V_i\),再给出 \(m(1\leq m\leq 10^6)\) 个询问,每次询问一个 \(S\) 的一个子集 \(T\),求所有 阅读全文
posted @ 2020-08-12 14:50 AE酱 阅读(241) 评论(0) 推荐(0) 编辑
摘要: 若 \(f(n)=\sum_{i=0}^n\binom{n}{i}g(i)\),则 \(g(n)=\sum_{i=0}^n(-1)^{n-i}\binom{n}{i}f(i)\) 。 证明: \[ g(n)=\sum_{i=0}^n(-1)^{n-i}\binom{n}{i}f(i)\\ =\sum 阅读全文
posted @ 2020-08-11 23:20 AE酱 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 子集反演 莫比乌斯变换 \[ f(S)=\sum_{T\subseteq S} g(T) \] 莫比乌斯反演 \[ g(S)=\sum_{T\subseteq S}(-1)^{|S|-|T|} f(T) \] 证明: 由 \[ \sum_{i=0}^n(-1)^{i}\binom{n}{i}=[n= 阅读全文
posted @ 2020-08-11 23:18 AE酱 阅读(1336) 评论(0) 推荐(1) 编辑
摘要: 题目大意 给定正整数 \(n,x,k\),求 \[ \sum_{a_1=1}^{n}\sum_{a_2=1}^n\dotsb\sum_{a_x=1}^n\left(\prod_{j=1}^xa_j^k\right)f\left(gcd\left(a_1,a_2,\dots,a_x\right)\ri 阅读全文
posted @ 2020-08-10 11:26 AE酱 阅读(209) 评论(3) 推荐(0) 编辑
摘要: #include <iostream> #include <algorithm> #include <cstring> #include <string> #include <cstdio> #include <vector> using namespace std; #define RG regi 阅读全文
posted @ 2020-08-01 16:13 AE酱 阅读(146) 评论(0) 推荐(0) 编辑
摘要: fhq-Treap 是一种非旋转平衡二叉树,代码很好写。 #include <iostream> #include <algorithm> #include <cstring> #include <string> #include <cstdio> #include <vector> #includ 阅读全文
posted @ 2020-08-01 16:12 AE酱 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 题目大意 给你一个 \(n(3\leq n\leq 50)\) 个点的完全图,每条边都有边权,且边权为 \([1,10^4]\) 范围内的随机数,要求删掉 \(k(1\leq k\leq \min(n-2,5))\) 条边,使得 $1\sim n$ 的最短路最长,输出删去 \(k\) 条边后最长的最 阅读全文
posted @ 2020-07-29 10:51 AE酱 阅读(293) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 14 下一页