We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
#include<iostream>#include<set>#include<string>#include<cassert>usingnamespacestd;intmain(){autoquery=string();size_tsz=0;autonum=0;cin>>sz;autoheap=set<int>();while(sz--){cin>>num;switch(num){case1:{cin>>num;heap.insert(num);break;}case2:{cin>>num;heap.erase(num);break;}case3:{cout<<*cbegin(heap)<<endl;break;}defaul:{assert(false&&"not known command");}}}return0;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
QHEAP1
You are viewing a single comment's thread. Return to all comments →
C++ (more at https://github.com/IhorVodko/Hackerrank_solutions , feel free to give a star :) )