rt,已经自己调过了没调出来,另外50分的测试点全WA了
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
deque<LL> q;
LL a[300010];
int main()
{
LL n, m, k;
cin >> n >> m >> k;
for(LL i = 1; i <= n; i ++)
cin >> a[i];
sort(a + 1, a + n + 1);
for(LL i = 1; i <= n; i ++) q.push_back(a[i]);
int x = 0;
int op, e;
for(LL i = 1; i <= m; i ++)
{
cin >> op;
if(op == 1)
{
cin >> e;
x += e;
while(q.size() && q.front() + x < -k) q.pop_front();
while(q.size() && q.back() + x > k) q.pop_back();
}
else if(op == 2)
{
cin >> e;
x -= e;
while(q.size() && q.front() + x < -k) q.pop_front();
while(q.size() && q.back() + x > k) q.pop_back();
}
else if(op == 3)
{
cout << q.size() << "\n";
}
}
return 0;
}