Pagini recente » Cod sursa (job #2679022) | Cod sursa (job #1620474) | Cod sursa (job #3189995) | Cod sursa (job #1624471) | Cod sursa (job #2581702)
#include <bits/stdc++.h>
const int inf=2e9;
const int nmax=1e6+3;
const int mod=666019;
using namespace std;
vector<int>v[nmax];
void adauga(int x)
{
int cheie=x%mod;
v[cheie].push_back(x);
}
void sterge(int x)
{
int cheie=x%mod;
for(int i=0;i<v[cheie].size();i++)
if(v[cheie][i]==x) v[cheie].erase(v[cheie].begin()+i);
}
bool cauta(int x)
{
int cheie=x%mod;
for(auto it:v[cheie])
if(it==x) return 1;
return 0;
}
int main()
{
ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
freopen("hashuri.in","r",stdin);
freopen("hashuri.out","w",stdout);
int t;
cin>>t;
while(t--)
{
int k,x;
cin>>k>>x;
if(k==1) adauga(x); else
if(k==2) sterge(x); else
cout<<cauta(x)<<"\n";
}
}