社区讨论
为什么不对
P1486[NOI2004] 郁闷的出纳员参与者 4已保存回复 3
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 3 条
- 当前快照
- 1 份
- 快照标识符
- @lyjkr5sm
- 此快照首次捕获于
- 2024/07/13 11:36 2 年前
- 此快照最后确认于
- 2024/07/13 14:18 2 年前
CPP
#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;
}
回复
共 3 条回复,欢迎继续交流。
正在加载回复...