You are viewing a single comment's thread. Return to all comments →
Here is a C++ program that should solve the problem:
int main() { int q; std::cin >> q; std::set s; for (int i = 0; i < q; i++) { int y, x; std::cin >> y >> x; if (y == 1) { s.insert(x); } else if (y == 2) { s.erase(x); } else { std::cout << (s.count(x) ? "Yes" : "No") << std::endl; } } 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 →
Here is a C++ program that should solve the problem:
include
include
int main() { int q; std::cin >> q; std::set s; for (int i = 0; i < q; i++) { int y, x; std::cin >> y >> x; if (y == 1) { s.insert(x); } else if (y == 2) { s.erase(x); } else { std::cout << (s.count(x) ? "Yes" : "No") << std::endl; } } return 0; }