摘要:
原题链接 题解 1.把天数抽象为数组,下标代表天数,值代表每天能借的教室数 2.订单抽象成区间,每个点覆盖的区间数不超过其值,问第一个无法覆盖的区间是? 3.具有单调性,考虑二分 4.区间覆盖可以用差分线性复杂度求出来 code #include<bits/stdc++.h> using names 阅读全文
posted @ 2024-06-26 16:15
纯粹的
阅读(32)
评论(0)
推荐(0)
摘要:
原题链接 题解 我一开始想遍历每一个点,然后求出能和它配对的点的权值,但是参考菊花图,这样的速度太慢,所以考虑用一个点表示多个配对,于是发现每个点都可以作为配对的中间点 code #include<bits/stdc++.h> using namespace std; const int mod=1 阅读全文
posted @ 2024-06-26 14:56
纯粹的
阅读(14)
评论(0)
推荐(0)
摘要:
原题链接 题解 贪心,遇到大坑就建立一条到小坑自动减少的区间 code #include<bits/stdc++.h> using namespace std; int a[100005]; int main() { int n; cin>>n; int sum=0; for(int i=1;i<= 阅读全文
posted @ 2024-06-26 13:08
纯粹的
阅读(16)
评论(0)
推荐(0)
摘要:
原题链接 题解 随便找两个数字,删哪个更优? 发现了什么规律? code #include<bits/stdc++.h> using namespace std; struct node { int v,id,l,r; }c[300]; int main() { string s; cin>>s; 阅读全文
posted @ 2024-06-26 11:50
纯粹的
阅读(15)
评论(0)
推荐(0)
摘要:
原题链接 题解 对于线段A,选与线段A有交叉,且结束时间比A晚的线段一定不比选线段A更优 code #include<bits/stdc++.h> using namespace std; struct node { int l,r; }seg[1000005]; bool cmp(node a,n 阅读全文
posted @ 2024-06-26 11:11
纯粹的
阅读(27)
评论(0)
推荐(0)

浙公网安备 33010602011771号