Pagini recente » Cod sursa (job #2773941) | Cod sursa (job #878399) | Cod sursa (job #414141) | Cod sursa (job #2233787) | Cod sursa (job #2299444)
#include <iostream>
#include <fstream>
#include <vector>
#define MOD 666013
using namespace std;
ifstream si("hashuri.in");
ofstream so("hashuri.out");
vector<int>l[MOD];
vector<int>::iterator findp(int val) {
int poz=val%MOD;
vector<int>::iterator i;
for(i=l[poz].begin();i!=l[poz].end();++i)
{
if(*i==val)
return i;
}
return l[poz].end();
}
void update(int val) {
int poz=val%MOD;
vector<int>::iterator i=findp(val);
if(i==l[poz].end())
l[poz].push_back(val);
}
void del(int val) {
int poz=val%MOD;
vector<int>::iterator i=findp(val);
if(i!=l[poz].end())
l[poz].erase(i);
}
int main() {
int n;
si>>n;
int a,b;
for(int i=0;i<n;++i) {
si>>a>>b;
if(a==1) {
update(b);
}
else {
if(a==2)
del(b);
else
so<<(findp(b)!=l[b%MOD].end())<<'\n';
}
}
return 0;
}