Pagini recente » Cod sursa (job #1331620) | Cod sursa (job #2199589) | Cod sursa (job #1814736) | Cod sursa (job #876678) | Cod sursa (job #2555146)
#include<bits/stdc++.h>
using namespace std;
const int mod=666013;
ifstream f ("hashuri.in");
ofstream g ("hashuri.out");
int n,tip,elem,i,rest;
list<int> v[mod];
list<int>::iterator it;
void tip_1(int x)
{
rest=x % mod;
v[rest].push_back(x);
}
void tip_2(int x)
{
rest=x%mod;
for(it=v[rest].begin(); it!=v[rest].end(); it++)
if(*it==x) {
v[mod].erase(it);
break;
}
}
bool tip_3(int x)
{
rest=x%mod;
for(it=v[rest].begin(); it!=v[rest].end(); it++)
if(*it==x) return true;
return false;
}
int main()
{
f >> n;
for(i=1; i<=n; i++) {
f >> tip >> elem;
if(tip==1) tip_1(elem);
else if(tip==2) tip_2(elem);
else g << tip_3(elem) << "\n";
}
return 0;
}