Pagini recente » Cod sursa (job #449476) | Cod sursa (job #760398) | Cod sursa (job #3255942) | Cod sursa (job #3126457) | Cod sursa (job #2623755)
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(a) (a).begin(), (a).end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define rc(s) return cout<<s,0
#define pi pair <int, int>
#define sz(x) (int)((x).size())
//#define int long long
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const ll inf = 0x3f3f3f3f3f3f3f;
const ll mod = 1e4 + 7;
const int N = 33e3 + 11;
const int M = 1e6 + 11;
const int INF = 2e9;
const ll INF64 = 3e18 + 1;
const double lil = 0.0000000000001;
ifstream in ("hashuri.in");
ofstream out ("hashuri.out");
int m, o, x;
vector<int>v[mod];
bool find(int x){
for(auto it : v[x % mod]){
if(it == x)return 1;
}
return 0;
}
void insert(int x){
if(find(x))return;
v[x % mod].push_back(x);
}
void erase(int x){
for(int i = 0; i < sz(v[x % mod]); i++){
if(v[x % mod][i] == x){
swap(v[x % mod][i],v[x % mod].back());
v[x % mod].pop_back();
}
}
}
void solve(){
in >> m;
while(m--){
in >> o >> x;
if(o == 1){
insert(x);
}else
if(o == 2){
erase(x);
}else{
out << find(x) << '\n';
}
}
}
int32_t main(){
ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
int t = 1;
//cin >> t;
while(t--){
solve();
}
}