Pagini recente » Cod sursa (job #1207552) | Cod sursa (job #504672) | Cod sursa (job #2563298) | Cod sursa (job #327446) | Cod sursa (job #1290493)
#include<algorithm>
#include<bitset>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<deque>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
using namespace std;
#define dbg(x) (cout<<#x<<" = "<<(x)<<'\n')
#ifdef HOME
const string inputFile = "input.txt";
const string outputFile = "output.txt";
#else
const string problemName = "hashuri";
const string inputFile = problemName + ".in";
const string outputFile = problemName + ".out";
#endif // HOME
typedef long long int lld;
typedef pair<int, int> PII;
typedef pair<int, lld> PIL;
typedef pair<lld, int> PLI;
typedef pair<lld, lld> PLL;
typedef pair<double, double> Point;
const int INF = (1LL << 30) - 1;
const lld LINF = (1LL << 62) - 1;
const int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};
const int MOD = 666013;
const int NMAX = 500000 + 5;
const int MMAX = 100000 + 5;
const int KMAX = 100000 + 5;
const int PMAX = 100000 + 5;
const int LMAX = 100000 + 5;
const int VMAX = 100000 + 5;
int M;
vector<int> H[MOD + 5];
void insert(int x) {
int r = x % MOD;
for(auto y : H[r])
if(y == x)
return;
H[r].push_back(x);
}
void erase(int x) {
int r = x % MOD;
for(auto &y : H[r])
if(y == x) {
swap(H[r].back(), y);
H[r].pop_back();
return;
}
}
int find(int x) {
int r = x % MOD;
for(auto y : H[r])
if(y == x)
return 1;
return 0;
}
int main() {
int t, x;
#ifndef ONLINE_JUDGE
freopen(inputFile.c_str(), "r", stdin);
freopen(outputFile.c_str(), "w", stdout);
#endif
scanf("%d", &M);
while(M--) {
scanf("%d%d", &t, &x);
if(t == 1)
insert(x);
if(t == 2)
erase(x);
if(t == 3)
printf("%d\n", find(x));
}
return 0;
}