Cod sursa(job #629369)

Utilizator antoanelaAntoanela Siminiuc antoanela Data 3 noiembrie 2011 10:47:12
Problema Hashuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.56 kb
#include <cstdio>
#include <vector>
using namespace std;
#define p 666013

vector <int> v[p+5];

int main()
{
	freopen("hashuri.in","r",stdin);
	freopen("hashuri.out","w",stdout);
	int n, op, x, c, ok, i;	
	scanf("%d", &n);
	vector <int> :: iterator it;
	while (n--)
	{
		scanf("%d %d", &op, &x);
		c=x%p;
		if (op==1) 
			v[c].push_back(x); else
			{
				ok=0;
				for (it=v[c].begin(); it!=v[c].end(); it++)
					if (*it==x)
					{
						ok=1;
						if (op==2) v[c].erase(it);
						break;
					}
				if (op==3) printf("%d\n",ok);
			}
	}
}