Pagini recente » Cod sursa (job #1227328) | Cod sursa (job #798114) | Cod sursa (job #328124) | Cod sursa (job #645739) | Cod sursa (job #318622)
Cod sursa(job #318622)
#include<fstream>
#include<vector>
#define mod 100000
using namespace std;
ifstream in("hashuri.in");
ofstream out("hashuri.out");
int t,op,ok,x;
long int rest(int k)
{ return k%100000+1;
}
int main()
{ vector<int> hash[mod];
vector<int>::iterator it;
int i;
in>>t;
for(i=1;i<=t;i++)
{ in>>op>>x;
if(op==1)hash[rest(x)].push_back(x);
else if(op==2)
{ for(it=hash[rest(x)].begin();it<hash[rest(x)].end();it++)
if(*it==x)hash[rest(x)].erase(it);
}
else if(op==3)
{ ok=0;
for(it=hash[rest(x)].begin();it<hash[rest(x)].end();it++)
if(*it==x)ok=1;
out<<ok<<'\n';
}
}
in.close();
out.close();
return 0;
}