标签:iostream des erase find ace ios return bre main
7
add 1
add 1
ask 1
ask 2
del 2
del 1
ask 1
1
2
1 2
0 0
0
2
1 0
#include <iostream>
#include <set>
using namespace std;
int main()
{
multiset<int>a;
set<int>v;
char s[5];
int n, p;
multiset<int>::iterator m;
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> s >> p;
switch (s[1]) {
case ‘d‘:
a.insert(p);
v.insert(p);
cout << a.count(p) << endl;
break;
case ‘e‘:
cout << a.count(p) << endl;
m = a.find(p);
while (m != a.end()) {
a.erase(m);
m = a.find(p);
}
break;
case ‘s‘:
if (v.find(p) == v.end())cout << 0;
else cout << 1;
cout << ‘ ‘ << a.count(p) << endl;
break;
}
}
return 0;
}
标签:iostream des erase find ace ios return bre main
原文地址:https://www.cnblogs.com/orange-ga/p/12499610.html