为什么不对
查看原帖
为什么不对
939526
jy20091121楼主2024/7/13 11:34
#include<bits/stdc++.h>
using namespace std;
vector<int> 王业俊;
int n,m;
int ans;
int s,k;
int main() {
	cin>>n>>m;
	for(int i=1; i<=n; i++) {
		char x;
		cin>>x;
		int o;
		cin>>o;
		if(x=='I') {
			if(o<m) continue;
			王业俊.insert(lower_bound(王业俊.begin(),王业俊.end(),o),o);
		} else if(x=='A')
			for(int i=0; i<王业俊.size(); i++) 王业俊[i]+=o;
		else if(x=='S') {
			int s=王业俊.size();
			for(int i=0; i<s; i++) {
				王业俊[i]-=o;
				if(王业俊[i]<m) {
					王业俊.erase(lower_bound(王业俊.begin(),王业俊.end(),王业俊[i]));
					ans++;
					s--;
					i--;
				}
			}
		} else if(x=='F') {
			int s=王业俊.size();
			if(o>s)
				cout<<-1;
			else {
				cout<<王业俊[s-o];
			}
			cout<<"\n";
		}
	}
	cout<<ans;
	return 0;
}
2024/7/13 11:34
加载中...