05 2018 档案

摘要:这题和水管局长很像,枚举 $a$ 的边然后维护关于 $b$ 的最小生成树就可以了。 1A呐 _ include include using namespace std; int n, m, val[150005], zdz[150005], ans=0x3f3f3f3f, fa[150005]; i 阅读全文
posted @ 2018-05-31 08:26 poorpool 阅读(259) 评论(0) 推荐(0)
摘要:就是用 lct 维护最小生成树 "ref" cpp include include include include using namespace std; typedef pair par; int n, m, q, val[200005], zdz[200005], ans[200005], c 阅读全文
posted @ 2018-05-31 07:52 poorpool 阅读(234) 评论(0) 推荐(0)
摘要:cpp include include using namespace std; int n, uu, m; bool a[4500005], vis[4500005][2]; void dfs(int x, int y){ if(vis[x][y]) return ; vis[x][y] = tr 阅读全文
posted @ 2018-05-30 11:32 poorpool 阅读(461) 评论(0) 推荐(0)
摘要:圆方树orz,参见猫的课件(apio和wc的)以及 "这里" "那里" cpp include include using namespace std; typedef long long ll; int n, m, uu, vv, oea[100005], loo[100005], dfn[100 阅读全文
posted @ 2018-05-29 21:06 poorpool 阅读(245) 评论(0) 推荐(0)
摘要:"ref" 主要学到了期望有时候直接当平均值就好了,还有就是一个期望的问题: $E(x)=\sum_{i=1}^\infty P(x \geq i)$,他的意思是说对于一个变量 $x$,他的期望值是 $x \geq i$ 的概率之和。为什么呢? $E(x)=0(P(\geq 0) P(\geq 1) 阅读全文
posted @ 2018-05-29 09:44 poorpool 阅读(135) 评论(0) 推荐(0)
摘要:"ref" 前置技能是bzoj的串珠子。这种子集dp好神啊qwq。 还有这种钦定点转移子集的方法建议按这题的方法写,不要看串珠子qwq cpp include include using namespace std; typedef long long ll; int n, m, w[15], uu 阅读全文
posted @ 2018-05-28 21:15 poorpool 阅读(160) 评论(0) 推荐(0)
摘要:这是一道神子集dp…… "ref1" , "ref2" , "ref3" cpp include include using namespace std; int n, c[19][19], g[66005], f[66005]; typedef long long ll; const int mo 阅读全文
posted @ 2018-05-28 16:46 poorpool 阅读(129) 评论(0) 推荐(0)
摘要:原来矩阵树定理对于边是概率的情况也是适用的qwqwq。 "ref" cpp include include include using namespace std; int n; double w[55][55], uu; const double eps=1e 7; void gauss(){ f 阅读全文
posted @ 2018-05-28 10:07 poorpool 阅读(196) 评论(0) 推荐(0)
摘要:据说pkusc出了好几年半平面交了,我也来水一发 "ref" cpp include include include include using namespace std; int n, cnt, tot; const double eps=1e 7; struct Point{ double x 阅读全文
posted @ 2018-05-28 08:56 poorpool 阅读(112) 评论(0) 推荐(0)
摘要:graham扫描法,参考 "yyb" cpp include include include include using namespace std; int n, din; const double eps=1e 7; struct Point{ double x, y; Point(double 阅读全文
posted @ 2018-05-27 19:26 poorpool 阅读(119) 评论(0) 推荐(0)
摘要:和sdoi的相关分析很像qwq,推柿子然后线段树搞搞 阅读全文
posted @ 2018-05-27 17:10 poorpool 阅读(170) 评论(3) 推荐(0)
摘要:"ref" cpp include include include using namespace std; int n, a[500005], fa[500005], siz[500005], cnt[500005], ans[500005]; int hmn[500005]; double k; 阅读全文
posted @ 2018-05-27 07:35 poorpool 阅读(225) 评论(0) 推荐(0)
摘要:先推公式,推出个 "这" ,然后因为是 $0/1$ 矩阵,选一个有损耗,两个一组有加成,就想到了最大权闭合子图,(飞行计划问题) cpp include include include include using namespace std; int n, uu, ss, tt, hea[25050 阅读全文
posted @ 2018-05-25 11:43 poorpool 阅读(201) 评论(0) 推荐(0)
摘要:先考虑一下一个集合怎么用 $O(n)$ 时间求出来,然后用主席树推广到一个序列就可以了。大致思想就是考虑一个数的权值和它前面的数的和的关系。 阅读全文
posted @ 2018-05-25 09:57 poorpool 阅读(193) 评论(0) 推荐(0)
摘要:"ref" 真是道组合数学神题啊……第一次见第一类斯特林数…… 阅读全文
posted @ 2018-05-25 08:43 poorpool 阅读(243) 评论(0) 推荐(0)
摘要:"ref" 不是太懂…… 阅读全文
posted @ 2018-05-24 19:45 poorpool 阅读(262) 评论(0) 推荐(0)
摘要:我发现我的构造方法好像不太一样而且比较显然?……先读入 $q$ 数组(下表从零开始)。 记 $i j$ 时,$a_{i j}=1/i^2$;$i = j$ 时,$a_{i j}=0$。 答案 $E_i=\sum_{j=0}^{n 1}a_{i j}q_j$,可以用 FFT 优化,于是就做完了……吗? 阅读全文
posted @ 2018-05-23 22:07 poorpool 阅读(112) 评论(0) 推荐(0)
摘要:"ref" 总的来说,就是 1. 容斥转化为点对应到点集问题。 2. 树形 dp 解决转化后的问题。 cpp include include include include using namespace std; typedef long long ll; int n, m, hea[19], c 阅读全文
posted @ 2018-05-23 20:03 poorpool 阅读(133) 评论(0) 推荐(0)
摘要:"ref" cpp include include include include include using namespace std; typedef pair par; int n; par a[100005]; set se; map mp; int main(){ cin n; for( 阅读全文
posted @ 2018-05-23 18:56 poorpool 阅读(1152) 评论(0) 推荐(0)
摘要:还是挺好做的,$(e_1,e_2)=1 \Rightarrow e_1s+e_2t=0$,$m \equiv m^1 \equiv m^{e_1s+e_2t} \equiv c_1^s c_2^t$。exgcd求逆元 阅读全文
posted @ 2018-05-23 11:04 poorpool 阅读(289) 评论(0) 推荐(0)
摘要:大概就是一个形状要嵌到矩阵里头这样子,看看代码就明白了qwq cpp include include include include include using namespace std; int n, m, k, lim=1, limcnt, rev[8388655]; char ss[5000 阅读全文
posted @ 2018-05-23 09:16 poorpool 阅读(466) 评论(0) 推荐(0)
摘要:还是很好做的,大致就是manacher,每个位置为中心的最长回文串要是能抵到最右边就合法,要是能抵到最左边,那这个点的是否合法取决于以这个点为中心的最长回文串的右端点是否合法。 阅读全文
posted @ 2018-05-22 21:09 poorpool 阅读(458) 评论(0) 推荐(0)
摘要:"ref" 我是傻逼,我啥也不会,这是我抄的。 cpp include include include using namespace std; int n, a, b, w[55], tot, dy[1005], g[55][55], f[55][55][55][55], va[55]; bool 阅读全文
posted @ 2018-05-22 20:24 poorpool 阅读(354) 评论(0) 推荐(0)
摘要:"ref" pkusc 快到了,做点 ~~thusc 的~~题涨涨 rp…… cpp include include include include using namespace std; typedef long long ll; int n, k, ch[6000005][10], cnt, 阅读全文
posted @ 2018-05-22 17:11 poorpool 阅读(132) 评论(0) 推荐(0)
摘要:一个十进制分数 $p/q$ 在 $b$ 进制下是有限小数的充要条件是 $q$ 的所有质因子都是 $b$ 的质因子。 First, if $p$ and $q$ are not coprime, divide them on $\gcd(p,q)$. Fraction is finite if and 阅读全文
posted @ 2018-05-22 16:09 poorpool 阅读(174) 评论(0) 推荐(0)
摘要:"ref" 我好菜啊 cpp include include include include using namespace std; int n, u[2005], v[2005], f[2005][11][11][11][11]; int dis(int x, int y){ return ab 阅读全文
posted @ 2018-05-22 14:28 poorpool 阅读(257) 评论(0) 推荐(0)
摘要:pkusc 快到了……做点题涨涨 rp。 记 $f(S,i)$ 表示 $S$ 这个集合是决计不能选的(要么属于独立集,要么和独立集相连),或称已经考虑了的,$i$ 表示此集合对应的最大独立集大小。那么枚举一下哪些点 $j$ 不在 $S$ 里,记 $w_i$ 表示 $i$ 和与之相邻的点集,则 $f( 阅读全文
posted @ 2018-05-21 20:55 poorpool 阅读(811) 评论(0) 推荐(0)
摘要:$n=1$ 时特判四角,其余时刻圆的面积和必小于正方形面积,随机点出来判断就行了。 stm 随机算法…… include include include include include using namespace std; int n; double l, xx[15], yy[15]; con 阅读全文
posted @ 2018-05-21 19:04 poorpool 阅读(171) 评论(0) 推荐(0)
摘要:pkusc 快到了……做点题涨涨 rp。 "ref" 我好菜啊QAQ。 可以发现期望只是一个幌子。我们的目的是:对于所有随机的选择方法(一共 $\binom{2n}{m}$种),这些选择方法都最优地打出 $k$ 张牌,他们能造成的伤害的和是多少。 显然的是,能打强化就打强化(不过你好歹也要攻击一张) 阅读全文
posted @ 2018-05-21 08:43 poorpool 阅读(1145) 评论(2) 推荐(0)
摘要:pkusc 快到了……做点题涨涨 rp。 初见时 yy 了一个类似于归并的东西,$O(n^2)$,50 分。 50 分 yy 做法 对于一个点,枚举他能到达的权值(假设这个权值在左子树,在右子树是一样的),选上这个点的概率就是“在左子树选上这个点的概率 $\times$ (选择子结点最大值的概率 $ 阅读全文
posted @ 2018-05-20 19:49 poorpool 阅读(499) 评论(0) 推荐(0)
摘要:"set做法" ~~正解是trie……~~ 主要是要学会 $a\ \mathrm{xor}\ b \leq a+b$ 这种操作 cpp include include include using namespace std; int q, opt, uu, vv, ww; set se[100005 阅读全文
posted @ 2018-05-17 15:29 poorpool 阅读(545) 评论(0) 推荐(0)
摘要:分治+最短路,很套路的 cpp include include include include include using namespace std; int n, m, ans[100005], px[20005], py[20005], uu, hea[20005], cnt, q, din; 阅读全文
posted @ 2018-05-17 13:50 poorpool 阅读(126) 评论(0) 推荐(0)
摘要:loj 题面错的……去bzoj上看吧qwq 观察到 $\sqrt{|i j|}$ 的取值只有 $\sqrt{n}$ 级别个,然后就很显然了,rmq。 阅读全文
posted @ 2018-05-17 09:01 poorpool 阅读(125) 评论(0) 推荐(0)
摘要:"ref" 主要是要理解“撑到“最长这个概念 (为啥我的代码这么长QAQ cpp include include using namespace std; typedef unsigned long long ull; int n, pa[200005], pb[200005], ans; ull 阅读全文
posted @ 2018-05-17 08:14 poorpool 阅读(236) 评论(0) 推荐(0)
摘要:挺简单的,从 $n$ 到 $1$ 探讨是否能被加入。要加入的话必定是加入一条链,倍增以下看看要加多少,能不能加就可以了。 cpp include include include using namespace std; int n, k, hea[1000005], cnt, uu, vv, dep 阅读全文
posted @ 2018-05-16 20:27 poorpool 阅读(161) 评论(0) 推荐(0)
摘要:题意 定义一个串的权值是将其划分成 $k$ 组,使得每一组在满足“从组里选出一个数,再从组里选出一个数,它们的乘积没有平方因子”这样的前提时的最小的 $k$。每组的数不必相邻, 不必连续。 现在给你一串数,问你,权值为 $1,2,\ldots,n$ 的子串分别有多少个。 解答 显然如果一个数中含有平 阅读全文
posted @ 2018-05-16 20:04 poorpool 阅读(218) 评论(0) 推荐(0)
摘要:分数规划+树形依赖背包 "orz" 阅读全文
posted @ 2018-05-16 16:00 poorpool 阅读(223) 评论(0) 推荐(0)
摘要:"ref" 不是太懂 cpp include include include using namespace std; typedef unsigned long long ull; int T, n, m, hea[1000005], cnt, uu, vv, rnd[1000005], rot, 阅读全文
posted @ 2018-05-16 10:55 poorpool 阅读(146) 评论(0) 推荐(0)
摘要:"hihocoder系列" 这是一个系列讲解,好康的,有六集…… 构建SAM并求不同子串数 对应第二个讲解 cpp include include include using namespace std; typedef long long ll; int tot, n, maxLen[200000 阅读全文
posted @ 2018-05-15 19:20 poorpool 阅读(151) 评论(0) 推荐(0)
摘要:参考陈牧歌在apio2018的讲课课件 cpp include include include using namespace std; typedef long long ll; ll n; int pri[4641590], cnt, phi[4641590], msh[1544665][2]; 阅读全文
posted @ 2018-05-15 08:59 poorpool 阅读(140) 评论(0) 推荐(0)
摘要:day $ \infty$ $\sim$ day0 5 月 5 号左右的时候去了趟中北大学,山西省大学生程序设计竞赛。不是太满意,现场 rk3。拿到了充电宝(冲着这个去的,虽然抵不过车费),抽中了一本书,拿了件衣服。 5 月 9 号晚上坐火车从临汾到北京,10 号 5 点多到达。正是晨光熹微之时,p 阅读全文
posted @ 2018-05-10 22:20 poorpool 阅读(518) 评论(8) 推荐(0)
摘要:"ref" cpp include include include include using namespace std; typedef long long ll; typedef pair pir; int n, a, b, uu, vv, ww; map mp1; map mp2; int 阅读全文
posted @ 2018-05-09 10:08 poorpool 阅读(339) 评论(0) 推荐(0)
摘要:"ref" cpp include include using namespace std; int n, m, a[100005], opt, uu, vv, fa[100005], ch[100005][2], dis[100005]; int myfind(int x){ while(fa[x 阅读全文
posted @ 2018-05-08 19:51 poorpool 阅读(169) 评论(0) 推荐(0)
摘要:"ref" cpp include include include include include using namespace std; int n; char su[2005], sv[2005]; vector vec; void shift(int x){ if(x==0) return 阅读全文
posted @ 2018-05-08 18:44 poorpool 阅读(498) 评论(0) 推荐(0)
摘要:"ref" 阅读全文
posted @ 2018-05-08 10:36 poorpool 阅读(291) 评论(0) 推荐(0)
摘要:"ref" cpp include include include include using namespace std; typedef long long ll; int n, m, k, uu, vv, hea[105], cnt, tot[105]; ll b[105][1005], s[ 阅读全文
posted @ 2018-05-08 09:05 poorpool 阅读(136) 评论(0) 推荐(0)
摘要:"ref" cpp include include include using namespace std; typedef long long ll; int n, k, a[305], c[305]; ll w[305], dp[305][305][265], g[2]; int main(){ 阅读全文
posted @ 2018-05-07 20:45 poorpool 阅读(225) 评论(0) 推荐(0)
摘要:cpp include include include include using namespace std; int n, m, e, a[305], w[305][305], uu, vv, ww, hea[805], cnt, ss, tt, maxFlow; int lev[805], c 阅读全文
posted @ 2018-05-07 19:25 poorpool 阅读(161) 评论(0) 推荐(0)
摘要:"ref" cpp include include include include using namespace std; int n, m, q, a[100005], uu, vv, hea[100005], cnt, dfn[100005], loo[100005]; int idx, du 阅读全文
posted @ 2018-05-07 16:50 poorpool 阅读(252) 评论(0) 推荐(0)
摘要:答案就是错排数 阅读全文
posted @ 2018-05-07 11:27 poorpool 阅读(144) 评论(0) 推荐(0)
摘要:"字符串好难啊不会啊" cpp include include using namespace std; int n, m, rnk[100005], cnt[100005], tmp[100005], p, mx=128, saa[100005], tot, a, b; int height[10 阅读全文
posted @ 2018-05-07 10:59 poorpool 阅读(358) 评论(0) 推荐(0)
摘要:可持久化trie。考场上我脑补了一个trie树合并也A了 cpp include include include using namespace std; int n, k, m, dfnl[100005], dfnr[100005], idx, rot[100005], v[100005], uu 阅读全文
posted @ 2018-05-06 21:29 poorpool 阅读(258) 评论(0) 推荐(0)
摘要:超 dark van♂全背包 "ref1" "ref2" 阅读全文
posted @ 2018-05-06 20:02 poorpool 阅读(291) 评论(0) 推荐(0)
摘要:"problem" cpp include include include using namespace std; typedef long long ll; int n, a[2005]; ll dp[2005][2005]; int main(){ cin n; for(int i=1; i 阅读全文
posted @ 2018-05-06 17:12 poorpool 阅读(168) 评论(0) 推荐(0)
摘要:"推柿子" "第二类斯特林数的容斥表达" fft卡精度就用ntt吧qwq。 cpp include include using namespace std; typedef long long ll; int n, lim=1, limcnt, rev[300005], inv[300005], a 阅读全文
posted @ 2018-05-04 21:23 poorpool 阅读(108) 评论(0) 推荐(0)
摘要:记横联通是一块横着的没有硬石头的地,把他们编号。竖联通同理。 对于一个空地,将其横联通编号和竖联通编号连边,二分图匹配,最大匹配为答案。 cpp include include include include using namespace std; int n, m, hr[55][55], sr 阅读全文
posted @ 2018-05-04 11:02 poorpool 阅读(154) 评论(0) 推荐(0)
摘要:当年我还没学cdq的时候在luogu上写过树套树的代码orzzz "ref" cpp include include include using namespace std; int n, m, uu, vv, dp[100005], c[100005]; struct Node{ int val, 阅读全文
posted @ 2018-05-04 09:48 poorpool 阅读(158) 评论(0) 推荐(0)
摘要:刚入门cdq分治(入了吗),再研究研究orz cpp include include include using namespace std; int n, opt, xu, yu, xv, yv, ans[10005], cnt, c[2000005]; struct Node{ int x, y 阅读全文
posted @ 2018-05-04 08:38 poorpool 阅读(176) 评论(0) 推荐(0)
摘要:枚举 $k$,对于每个点 $i$ 我们最多删 $deg_i k$ 条边,就源点向第一部、第二部向汇点连边,容量是 $deg_i k$,原边连上,容量是 $1$,这样每流过一条原边在网络流图中的边时,就代表这条边可以删掉。也即没有流过的边就是 $k$ 时的答案 cpp include include 阅读全文
posted @ 2018-05-04 07:18 poorpool 阅读(257) 评论(0) 推荐(0)
摘要:"qaq" cpp include include include using namespace std; typedef long long ll; int n, a, b; ll ans, tmp; struct Node{ ll hp, dm; }nd[200005]; bool cmp(N 阅读全文
posted @ 2018-05-03 20:55 poorpool 阅读(781) 评论(0) 推荐(0)
摘要:"ref" cpp include include include include using namespace std; int n, d[305], deg[1005]; vector vec; int main(){ cin n; for(int i=1; i 阅读全文
posted @ 2018-05-03 20:35 poorpool 阅读(249) 评论(0) 推荐(0)
摘要:"ref1" "ref2" "ref3" "ref4" cpp include include include using namespace std; int n, k, c[200005], cnt[200005]; struct Node{ int x, y, z, idx, ans; boo 阅读全文
posted @ 2018-05-03 16:42 poorpool 阅读(161) 评论(0) 推荐(0)
摘要:"ref" cpp include include include using namespace std; int n, m, a[100005], sum[400005], tag[400005], q; struct Node{ int opt, lll, rrr; }nd[100005]; 阅读全文
posted @ 2018-05-03 09:56 poorpool 阅读(174) 评论(0) 推荐(0)
摘要:"线段树合并" 好写好调,隔壁老王的treap+启发式合并难写难调 cpp include include using namespace std; int n, m, fa[100005], val[100005], rot[100005], uu, vv, fan[100005], cnt; i 阅读全文
posted @ 2018-05-02 17:07 poorpool 阅读(149) 评论(0) 推荐(0)
摘要:"ref" 阅读全文
posted @ 2018-05-02 15:29 poorpool 阅读(186) 评论(0) 推荐(0)
摘要:学习一发平面图的姿势…… "ref" cpp include include include include include using namespace std; typedef long long ll; int n, m, k, cnt, uu, vv, nxt[1200005], bel[ 阅读全文
posted @ 2018-05-02 10:08 poorpool 阅读(221) 评论(0) 推荐(0)
摘要:"ref" cpp include include include include include using namespace std; int n, tot, dfn[100005], s[100005][26], dep[100005], idx, siz[100005], ans; boo 阅读全文
posted @ 2018-05-01 20:46 poorpool 阅读(403) 评论(0) 推荐(0)
摘要:"ref" cpp include include using namespace std; int a[100005], n, l, ans=0x3f3f3f3f; int main(){ cin n l; for(int i=1; i 阅读全文
posted @ 2018-05-01 19:46 poorpool 阅读(184) 评论(0) 推荐(0)
摘要:呸,大傻逼题,我更傻逼 "ref" cpp include using namespace std; typedef long long ll; ll n, k, m, d, ans; int main(){ cin n k m d; for(int i=1; i 阅读全文
posted @ 2018-05-01 19:35 poorpool 阅读(468) 评论(0) 推荐(0)