You are viewing a single comment's thread. Return to all comments →
#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> #include <set> using namespace std; set<int> s; void add(int x) { s.insert(x); } void remove(int x) { s.erase(x); } bool isPresent(int x) { if(s.find(x) != s.end()) return true; else return false; } int main() { int t; cin>>t; while(t--) { int y, x; cin>>y>>x; switch (y) { case 1: add(x); break; case 2: remove(x); break; case 3: (isPresent(x)) ? cout<<"Yes\n" : cout<<"No\n"; break; default: break; } } return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Sets-STL
You are viewing a single comment's thread. Return to all comments →