摘要:
传送门: "洛谷 P1937 仓配置" 题目描述: 如图,牛栏里只能容纳一定空间,进行线段覆盖,且覆盖数不能超过空间,求最大线段数 算法分析:考虑贪心:先让靠右的、占线段长度最小的入驻,这样就能避免覆盖中的重合问题。这样排序,然后用线段树维护当前区间剩余数量的最小值,若能入住 ($query 0$) 阅读全文
摘要:
线段树 1.区间加和区间查询 cpp include include include using namespace std; int n; long long ans(); int main() { int t; scanf("%d",&t); for(int i=1;i正质因数个数为$\delt 阅读全文