Cod sursa(job #706004)

Utilizator BeniLehelBeni Lehel BeniLehel Data 5 martie 2012 12:50:52
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.82 kb
#include<algorithm>
#include<stdio.h>
#include<vector>
#include <set>
#define p 666013 
using namespace std;

vector <long long> st[p];
vector<long long>::iterator it;

long long n,q,w,s;

void be()
{
	it=find(st[s].begin(),st[s].end(),w);
	if(it == st[s].end() )
		st[s].push_back(w);
}
void torol()
{
	it=find(st[s].begin(),st[s].end(),w);
	if(it!=st[s].end())
		st[s].erase(it);
}
void ki()
{
	it=find(st[s].begin(),st[s].end(),w);
	if(it != st[s].end())
		printf("1\n");
	else
		printf("0\n");
}

int main()
{
	freopen("hashuri.in","r",stdin);
	freopen("hashuri.out","w",stdout);
	scanf("%lld",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%lld%lld",&q,&w);
		s=w%p;
		switch(q)
		{
		case 1:be();break;
		case 2:torol();break;
		case 3:ki();break;
		default: break;
		}
			
	}
	return 0;
}