Josif_tepe

Untitled

May 9th, 2026
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include <iostream>
  2. #include <set>
  3. using namespace std;
  4. int main() {
  5.    
  6.     int q;
  7.     cin >> q;
  8.    
  9.     set<int> st;
  10.     for(int i = 0; i < q; i++) {
  11.         int x, y;
  12.         cin >> x >> y;
  13.        
  14.         if(x == 1) {
  15.             st.insert(y);
  16.         }
  17.         else if(x == 2) {
  18.             if(st.count(y)) {
  19.                 st.erase(y);
  20.             }
  21.         }
  22.         else {
  23.             if(st.count(y)) {
  24.                 cout << "Yes\n";
  25.             }
  26.             else {
  27.                 cout << "No\n";
  28.             }
  29.         }
  30.     }
  31.     return 0;
  32. }
  33.  
  34.  
  35.  
Advertisement
Add Comment
Please, Sign In to add comment