Pagini recente » Monitorul de evaluare | Clasament runda_de_codat_formule | Istoria paginii runda/simulare_oji2008 | Arhiva de probleme | Cod sursa (job #1941444)
#include <fstream>
#include <vector>
#define mod 66013
#define nmax 1000004
using namespace std;
ifstream f("hash.in");
ofstream g("hash.out");
int n, op, i, x, ok;
vector<int>v[nmax];
vector<int>::iterator it;
int main()
{
f>>n;
while(n!=0){
f>>op>>x;
i=x%mod;
if(op==1) v[i].push_back(x);
else if(op==2){
for(it=v[i].begin();it!=v[i].end();it++)
if(*it==x){
v[i].erase(it);
break;
}
}
else if(op==3){
ok=0;
for(it=v[i].begin();it!=v[i].end();it++)
if(*it==x){
g<<1<<'\n';
ok=1;
break;
}
if(ok==0)
g<<0<<'\n';
}
n--;
}
}