Cod sursa(job #2555410)
| Utilizator | Data | 23 februarie 2020 23:49:06 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 70 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.5 kb |
#include <bits/stdc++.h>
using namespace std;
struct Hash{
inline int operator () (const int& a) const{
return a % 66601;
}
};
int main(){
ifstream cin("hashuri.in");
ofstream cout("hashuri.out");
int n, x, op;
unordered_set<int, Hash> st;
cin >> n;
for(int i = 1; i <= n; ++i){
cin >> op >> x;
if(op == 1)
st.insert(x);
else if(op == 2){
if(st.find(x) != st.end())
st.erase(x);
}
else{
if(st.find(x) != st.end())
cout << 1 << '\n';
else
cout << 0 << '\n';
}
}
}
