Pagini recente » Cod sursa (job #855587) | Cod sursa (job #352475) | Cod sursa (job #780770) | Cod sursa (job #2788383) | Cod sursa (job #863386)
Cod sursa(job #863386)
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> v[1000];
int n,x,op;
int main()
{
freopen("hashuri.in","r",stdin);
freopen("hashuri.out","w",stdout);
scanf("%d", &n);
for(int i=0;i<n;i++)
{
scanf("%d %d", &op,&x);
if(op==1)
if( find( v[x%1000].begin() , v[x%1000].end() , x) == v[x%1000].end() )
v[x%1000].push_back(x);
if(op==2)
if( find( v[x%1000].begin() , v[x%1000].end() , x) != v[x%1000].end() )
v[x%1000].erase( find( v[x%1000].begin() , v[x%1000].end() , x) );
if(op==3)
if(find(v[x%1000].begin(),v[x%1000].end(),x)==v[x%1000].end())
printf("0\n");
else
printf("1\n");
}
return 0;
}