求助语法
  • 板块学术版
  • 楼主huazai676
  • 当前回复3
  • 已保存回复3
  • 发布时间2023/3/12 11:37
  • 上次更新2023/10/23 21:47:46
查看原帖
求助语法
641290
huazai676楼主2023/3/12 11:37

求助c++“->”是什么意思,比如下面的那篇代码。

#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define ll long long
#define repeat(i,a,b) for(int i=(a),i##__end=(b);i<i##__end;i++)
#define repeat_back(i,a,b) for(int i=(b)-1,i##__end=(a);i>=i##__end;i--)
#define mst(a,x) memset((a),(x),sizeof(a))
#define pii pair<int,int>

tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> t;//红黑树

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int n,op,x;
	cin>>n;
	repeat(i,0,n){
		cin>>op>>x;
		if(op==1)t.insert({x,i+1});
		if(op==2)t.erase(t.lower_bound({x,0}));
		if(op==3)cout<<t.order_of_key({x,0})+1<<endl;
		if(op==4)cout<<t.find_by_order(x-1)->first<<endl;
		if(op==5)cout<<prev(t.lower_bound({x,0}))->first<<endl;
		if(op==6)cout<<t.lower_bound({x+1,0})->first<<endl;
	}
	return 0;
}
2023/3/12 11:37
加载中...