11 2020 档案
摘要:其实博弈的思路已经非常明显,继续分析下去便好 这种类型的题目使用双端队列进行优化的技巧也要开始掌握了 使用队列,栈这种数据结构的时候要注意是否清零或者为空 分类讨论,发现是递归问题 while(1)处理 #include <stdio.h> #include <algorithm> #include
阅读全文
摘要:T2 总体思路:先求简单问题,通过修正值来求最小 关键思想:单个答案多个元素求答案 单个元素对多个答案做贡献 发现sum是一定的,我们只需要求出之间的修正值就可以了 二维差分就可以解决 代码如下: #include<cctype> #include<cstdio> #include<cstring>
阅读全文
摘要:#include <stdio.h> #include <algorithm> #include <cstring> #include <cctype> #define lson k<<1 #define rson k<<1|1 #define mid (l+r)>>1 using namespac
阅读全文
摘要:T1 T4: 带权中位数问题: 问题模型:节点到数轴上某一点的距离之和最短 结论:中位数或者带权中位数的点 证明:左右逼近,左边人数大于右边显然不能继续往左,那么这辆左右两边人数尽量相等的时候最优 https://www.cnblogs.com/chenhuanfa/archive/2012/11/
阅读全文
摘要:T1: 预处理的时候没有必要所有的都处理完毕,能够只处理有效信息才是关键/ 枚举的关键就在于枚举元素和枚举个数的转移 例:我需要 li->ri的k次方的前缀和,我可以枚举k,从li->ri加到数组,也可以枚举li->ri,一次加到k的数组当中去 #请注意:在阶段划分如此明显的前提下,直接想搜索而否定
阅读全文
摘要:T2 : #include <stdio.h> #include <algorithm> #include <cstring> using namespace std; typedef long long ll; const ll mod=998244353; const int maxn=1e5+
阅读全文
摘要:#include <stdio.h> #include <algorithm> #include <cstring> #include <queue> using namespace std; const int maxn=20020; typedef pair<int,int> pii; prio
阅读全文
浙公网安备 33010602011771号