Pagini recente » Cod sursa (job #1262102) | Cod sursa (job #2027894) | Cod sursa (job #2391919) | Cod sursa (job #2641319) | Cod sursa (job #2400660)
#include <fstream>
#include <vector>
#define mod 576101
typedef unsigned long long ll;
using namespace std;
ifstream cin("hashuri.in");
ofstream cout("hashuri.out");
vector<ll> a[mod];
int n;
int find(ll h) {
int m = h % mod, i = 0;
while(i < a[m].size() && a[m][i] != h)
i++;
return i;
}
void push(ll h) {
int m = h % mod;
if(find(h) == a[h % mod].size())
a[h % mod].push_back(h);
}
void pop(ll h) {
int it = find(h), m = h % mod;
if(it != a[m].size())
a[m].erase(a[m].begin() + it);
}
int main() {
cin >> n;
while(n--) {
ll h;
int cer;
cin >> cer >> h;
switch(cer) {
case 1:
push(h);
break;
case 2:
pop(h);
break;
case 3:
cout << (find(h) != a[h % mod].size()) << '\n';
break;
}
}
return 0;
}