求大佬解惑
有没有哪一位大佬可以解答一下,样例过了,自测也能过,但是为啥提交却爆零?
#include <stdio.h>
#include <iostream>
#include <string>
#include <string.h>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <vector>
#include <set>
#define ios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define debug freopen("in.txt","r",stdin); freopen("out.txt","w",stdout)
using namespace std;
typedef long long ll;
const int MAXN = 1e4;
const int MOD = 1e9;
multiset<int> mt;
multiset<int>::iterator it;
int main()
{
ios;
int n, k;;
cin >> n >> k;
while (n--) {
string sh;
int t;
cin >> sh >> t;
it = mt.lower_bound(t - k);
if (sh == "add") {
if (mt.empty() || it != mt.end() && abs(*it - t) > k) mt.insert(t);
}
else if(sh=="query"){
if (it == mt.end() || abs(*it - t) > k) cout << "No" << '\n';
else cout << "Yes" << '\n';
}
else {
while (it != mt.end() && abs(*it - t) <= k) {
mt.erase(it);
it = mt.lower_bound(t - k);
}
}
}
return 0;
}