本场题解于8月1日晚上九点回忆时所写,尽可能还原答题时代码,两个题均是100%通过。
笔试题第一题:给定上课的开始时间和结束时间,求需要几个人可以把这些课完整的都上完。
把开始时间和结束时间点拆开 结束时间是-1 开始时间是1 然后sort排序 按节点大小排序 然后节点一样的 把-1的放前面 然后就变成前缀和最大值问题了
#include<bits/stdc++.h>
using namespace std;
const int maxn=4e5+200;
struct node{
int x,y;
}a[maxn];
bool cmp(node a, node b){
if(a.x==b.x)return a.y<b.y;
return a.x<b.x;
}
int main(){
int n;
scanf("%d",&n);
for(int i=0;i<n;i++