请问我的代码哪里编译错了
查看原帖
请问我的代码哪里编译错了
717599
dengjunhaodejia09楼主2024/4/5 20:17
#include <bits/stdc++.h>
using namespace std;
struct node{
	int l,r;
	bool operator< (const node x){
		return l<x.l;
	}
};
set<node> vec;
int main(){
//	ios::sync_with_stdio(0);
//	cin.tie(0);
//	cout.tie(0);
	int n,ans=0;
	cin>>n;
	for(int i=1;i<=n;i++){
		char c;
		cin>>c;
		if(c=='B'){
			cout<<ans<<"\n";
		}else{
			int sum=0,l,r;
			cin>>l>>r;
			node gg;
			gg.l=l;
			gg.r=0;
			auto id=lower_bound(vec.begin(),vec.end(),gg);
			for(auto ia=id;ia!=vec.end();ia++){
				if((*ia).l>r){
					break;
				}
				sum++;
				auto ii=ia;
				ii++;
				vec.erase(ia);
				if(ii==vec.end()){
					break;
				}
				ii--;
				ia=ii;
			}
			cout<<sum<<"\n";
			gg.l=l;
			gg.r=r;
			vec.insert(gg);
			ans-=sum-1;
		}
	}
	return 0;
}
2024/4/5 20:17
加载中...