随笔分类 - 二分
摘要:3117. 划分数组得到最小的值之和 - 力扣(LeetCode) 思路 对于这种划分区间段的问题,通常我们可以先考虑dp,dp[i][j]表示第i个num数作为第j段最后一个元素得到的前j段的最小和。用二分去查找合法区间的左右端点,因为m最大为10,考虑使用10颗线段树(用RMQ也可以)去维护区间
阅读全文
摘要:https://codeforces.com/contest/1490/problem/G 二分循环几轮,再二分哪个位置刚好够。 1 #define IO std::ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); 2 #define bug(x) co
阅读全文
摘要:https://codeforces.com/contest/1486/problem/D 1 #define IO std::ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); 2 #define bug(x) cout<<#x<<" is "<<x<<
阅读全文

浙公网安备 33010602011771号