Cod sursa(job #705994)

Utilizator BeniLehelBeni Lehel BeniLehel Data 5 martie 2012 12:05:30
Problema Hashuri Scor 30
Compilator cpp Status done
Runda Arhiva educationala Marime 0.73 kb
#include<algorithm>
#include<stdio.h>
#include<vector>
using namespace std;

vector <long long> v;
vector<long long>::iterator it;

long long n,q,w;

void be()
{
	it=find(v.begin(),v.end(),w);
	if(it == v.end() )
		v.push_back(w);
}
void torol()
{
	it=find(v.begin(),v.end(),w);
	if(it!=v.end())
		v.erase(it);
}
void ki()
{
	it=find(v.begin(),v.end(),w);
	if(it != v.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);
		switch(q)
		{
		case 1:be();break;
		case 2:torol();break;
		case 3:ki();break;
		default: break;
		}
			
	}
	return 0;
}