Pagini recente » Cod sursa (job #884812) | Cod sursa (job #1252008) | Cod sursa (job #3143611) | Cod sursa (job #313379) | Cod sursa (job #3131349)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
const int n=1000002;
vector<int> v[n];
int main()
{
int n,optiune,x,y;
fin>>n;
for(int i=0; i<n; i++){
fin>>optiune>>x;
switch(optiune){
case 1:{
y=x%1000002;
auto gasit = find(v[y].begin(),v[y].end(),x);
if(gasit == v[y].end())
v[y].push_back(x);
break;}
case 2:{
y=x%1000002;
auto gasit = find(v[y].begin(),v[y].end(),x);
if(gasit != v[y].end()){
int poz=distance(v[y].begin(), gasit);
v[y].erase(v[y].begin()+poz);
}
break;}
case 3:{
y=x%1000002;
auto gasit = find(v[y].begin(),v[y].end(),x);
if(gasit != v[y].end()){
fout<<1<<endl;
}
else
fout<<0<<endl;
break;}
}
}
return 0;
}