摘要: 问题的开始 现在有一个数列 \(\mathcal{f} _x\) 满足 \[ \mathcal{f} _x= \begin{cases} 1 & x=\{0, 1\} \\ \mathcal{f} _{x-1}+\mathcal{f} _{x-2} & otherwise \end{cases} \ 阅读全文
posted @ 2020-08-16 22:17 方而静 阅读(233) 评论(0) 推荐(0)
摘要: 题目描述 [HNOI2002][Luogu P2234] 营业额统计 题目大意 给定 \(n\) 个整数,求每个数和它之前的数的差的绝对值的最小值之和。 题解 暴力是 \(\mathcal{O}(n^2)\) ,本来能卡过的,结果被洛谷改小了时限。 想到对于每个数要快速找到离它最近的数,而平衡树的前 阅读全文
posted @ 2020-08-16 11:42 方而静 阅读(113) 评论(0) 推荐(0)
摘要: vector 预备动作 #include <vector> #include <algorithm> using namespace std; vector<int> tree; 插入数 \(x\) tree.insert(lower_bound(tree.begin(), tree.end(), 阅读全文
posted @ 2020-08-16 09:53 方而静 阅读(207) 评论(0) 推荐(0)