随笔分类 -  板子

摘要:struct DSU { vector<int> f, siz; DSU() {} DSU(int n) { init(n); } void init(int n) { f.resize(n); std::iota(f.begin(), f.end(), 0); siz.assign(n, 1); 阅读全文 »
posted @ 2023-12-03 21:01 potential-star 阅读(22) 评论(0) 推荐(0) 编辑
摘要:无限制最长连续的子序列和 https://www.acwing.com/problem/content/description/1481/ dp[i]=max(dp[i-1]+a[i],a[i]); 最终结果也就是在dp数组线性扫描找出最大值 int pos=max_element(dp+1,dp+ 阅读全文 »
posted @ 2023-11-28 21:28 potential-star 阅读(22) 评论(0) 推荐(0) 编辑
摘要:离散化是一种数据处理的技巧,本质上可以看成是一种 哈希,其保证数据在哈希以后仍然保持原来的全/偏序关系。 https://oi-wiki.org/misc/discrete/ 通俗地讲就是当有些数据因为本身很大或者类型不支持,自身无法作为数组的下标来方便地处理,而影响最终结果的只有元素之间的相对大小 阅读全文 »
posted @ 2023-11-12 21:10 potential-star 阅读(19) 评论(0) 推荐(0) 编辑
摘要:封装函数版本 template <typename T, class F = function<T(const T&, const T&)>> struct SparseTable { int n; vector<vector<T>> st; F func; SparseTable(const ve 阅读全文 »
posted @ 2023-11-07 17:44 potential-star 阅读(13) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示