摘要:
1007 Naive Operations 还是写的有点冗余。 ai / bi ,ai从0开始增,转换成bi一直减,减到0就说明除法商+1。这样就维护区间最小值,最小值 == 0就说明 +1。这还有个调和级数的概念。 #include <iostream> #include <algorithm> 阅读全文
摘要:
D. Kuro and GCD and XOR and SUM 字典树真好玩。。。 牛老板提供的思路:建1e5个 字典树,每个数插入到以它的因子为根所在的字典树中,这样就实现了整除,当然gcd(k, x) = k是必须的 然后如何保证v + x <= s 和 v ^ x 最大呢? 对于v + x < 阅读全文
摘要:
浙江省赛补 IMagic Points 比赛时,我还在一直纠结,5 3这条线为啥不行,结果下来才知道题目不能有重复点没有说,然后fdf说应该是2 7或者 2 5那条线,我也只能通过画图连猜想了。。。 #include <cstdio> #include <algorithm> #include <c 阅读全文
摘要:
FFT HDU 5452 Minimum Cut 和[POJ 3417] Network这道题差不多。 LCA + 树上差分。 统计每个节点和它父亲相连的边被覆盖的次数,那切割了这条边形成最小割,还需要切割被覆盖次数条副边。 求最小值即可。 #include <cstdio> #include <c 阅读全文
摘要:
[POJ 3417] Network LCA + 树上差分 #include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int maxn = 1e5+50; typedef long lon 阅读全文
摘要:
CodeForces 608C Chain Reaction #include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 50; int cov[100010]; ///覆盖个数 int sum[maxn]; struct 阅读全文
摘要:
FFT学习参考这两篇博客,很详细,结合这看,互补。 博客一 博客二 很大一部分题目需要构造多项式相乘来进行计数问题。 1. HDU 1402 A * B Problem Plus 把A和B分别当作多项式的系数。 #include <cstdio> #include <algorithm> #incl 阅读全文
摘要:
学习了两篇博客,存下来以免丢失。 http://blog.csdn.net/losteng/article/details/50893739 https://leileiluoluo.com/posts/kdtree-algorithm-and-implementation.html 阅读全文