Pagini recente » Cod sursa (job #491943) | Cod sursa (job #1369934) | Cod sursa (job #1575852) | Cod sursa (job #1962084) | Cod sursa (job #2331873)
///*
//ID: gabriel100
//LANG: C++
//TASK:
//*/
//#include <cstdio>
//#include <algorithm>
////#include <time.h>
//#include <queue>
//#include <cmath>
//#include <stack>
//#include <fstream>
//#include <bitset>
//#include <set>
//#include <map>
//#include <ctime>
//#include <list>
//#include <cstring>
//
//#define nl '\n'
//#define F first
//#define S second
//#define vi vector<int>
//#define all(v) v.begin(),v.end()
//#define eb(x) emplace_back(x)
//#define ull unsigned long long
//#define ll long long
//#define ProblemName "ctc"
//#define LocalName "data"
//#ifdef INFOARENA
//#define Filename ProblemName
//#else
//#define Filename LocalName
//#endif
//#define Input Filename".in"
//#define Output Filename".out"
//using namespace std;
//ifstream cin(Input);
//ofstream cout(Output);
//
//template<class a, class type>
//void print(a v, type t) {
// for_each(all(v), [](type x) { cout << x << ' '; });
// cout << nl;
//}
//
//struct nod {
// vi v1;
// vi v2; // invers
//};
//int n, m;
//nod v[2 * 100000 + 1];
//
//inline void add(const int &ind, const int &val) {
// v[ind].v1.emplace_back(val);
// v[val].v2.emplace_back(ind); //inv
//}
//
//bitset<2 * 100001> viz;
//stack<int> s;
//
//inline void dfs(int i) {
// viz[i] = true;
// for (auto it = v[i].v1.begin(); it != v[i].v1.end(); ++it) {
// if (!viz[*it]) {
// dfs(*it);
// }
// }
// s.push(i);
//}
//
//int grup[2 * 100001];
//int nrGrup = 1;
//
//vector<vi > ans;
//
//inline void dfs_inv(int i) {
// viz[i] = true;
// for (auto it = v[i].v2.begin(); it != v[i].v2.end(); ++it) {
// if (!viz[*it]) {
// dfs_inv(*it);
// }
// }
// if (i > n)
// ans[nrGrup - 0b1].eb(i - n);
// else
// ans[nrGrup - 0b1].eb(-i);
// grup[i] = nrGrup;
//}
//
//int main() {
// ios_base::sync_with_stdio(false);
// clock_t tStart = clock();
// cin >> n >> m;
// int x1, x2;
// for (int j = 0; j < m; ++j) {
// cin >> x1 >> x2;
// if (x1 < 0 && x2 < 0) { // ambele negata
// add(-x1 + n, -x2); // x1 -> ~x2 1,2,3 .. n sunt negate n+1, n+2 .. n+n=2*n NU sunt negate
// add(-x2 + n, -x1); // x2 -> ~x1
// } else if (x1 > 0 && x2 > 0) {
// add(x1, x2 + n); // ~x1 -> x2
// add(x2, x1 + n); // ~x2 -> x1
// } else if (x1 < 0 && x2 > 0) {
// add(-x1 + n, x2 + n); // x1 -> x2 ~~x1 = x1
// add(x2, -x1); // ~x2 -> ~x1
// } else if (x1 > 0 && x2 < 0) {
// add(x1, -x2);
// add(-x2 + n, x1 + n);
// }
// }
// for (int i = 1; i <= n * 2; ++i) {
// if (!viz[i]) {
// dfs(i);
// }
// }
//
// for (int i = 0; i <= 2 * n; ++i)viz[i] = false; // foarte important:: aici ESTE 2*N !!!!!!!!!!
// vi temp;
// while (!s.empty()) {
// if (!viz[s.top()]) {
// ans.emplace_back(temp);
// dfs_inv(s.top());
// ++nrGrup;
// }
// cout << s.top() << ' ';
// s.pop();
// }
// // verificare
// int nuExistaSolutie = -1;
// for (int i = 1; i <= n; ++i) {
// if (grup[i] == grup[i + n]) { // nrGrup incepe de la 1
// cout << nuExistaSolutie << nl;
// return 2;
// }
// }
//
// cout.close();
// printf("\nTime taken: %.2fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC);
//}
#include <cstdio>
#include <unordered_set>
using namespace std;
int n,c,nr,NR;
unordered_set<int> a;
int main()
{
freopen("hashuri.in","r",stdin);
freopen("hashuri.out","w",stdout);
scanf("%d ", &n);
for(int i=1; i<=n; ++i)
{
scanf("%d %d ",&c,&nr);
if(c==1) a.insert(nr);
if(c==2)
a.erase(nr);
if(c==3)
printf("%d\n",a.find(nr) != a.end());
}
return 0;
}