Pagini recente » Cod sursa (job #1163940) | Cod sursa (job #2227883) | Cod sursa (job #1920145) | Cod sursa (job #177600) | Cod sursa (job #2410176)
#include <bits/stdc++.h>
#define ff first
#define ss second
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
const string file = "hashuri";
const ll INF = 9223372036854775807ll;
const int inf = 2147483647, M = 666013;
int test;
vector<int> v[M+5];
vector<int>::iterator where(int x)
{
for (vector<int>::iterator it = v[x%M].begin(); it != v[x%M].end(); ++it)
if(*it == x)
return it;
return v[x%M].end();
}
int main()
{
ifstream fin (file+".in");
ofstream fout (file+".out");
fin >> test;
while(test--){
int t, x;
fin >> t >> x;
if(t == 1){
if(where(x) == v[x%M].end())
v[x%M].push_back(x);
}else if (t == 2){
vector<int>::iterator it = where(x);
if(it != v[x%M].end())
v[x%M].erase(it);
}else
fout << (where(x) != v[x%M].end()) << "\n";
}
return 0;
}