Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <set>
- using namespace std;
- ifstream f("mset.in");
- ofstream g("mset.out");
- multiset <int> MS;
- multiset<int>::iterator itlow,itup,it;
- int n,op,x;
- int main()
- {
- f>>n;
- for(int i=1;i<=n;++i)
- {
- f>>op;
- if(op==1)
- {
- f>>x;
- MS.emplace(x);
- }
- if(op==2)
- {
- f>>x;
- itlow=MS.lower_bound(x);
- itup=MS.upper_bound(x);
- MS.erase(itlow,itup); // ^
- }
- if(op==3)
- {
- if(MS.empty()) /// Daca multisetul MS e vid
- g<<-1<<'\n';
- else
- {
- it=MS.begin();
- g<<*it<<' '<<MS.count(*it)<<'\n';
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement