Pagini recente » Cod sursa (job #2762499) | Cod sursa (job #428391) | Cod sursa (job #1654299) | Cod sursa (job #2563011) | Cod sursa (job #1647653)
#include <fstream>
#include <vector>
#define w 2000001
using namespace std;
vector <unsigned int> a[w];
unsigned int poz;
bool findh(unsigned int x)
{
unsigned int i,fx=x;bool ok=1;
x%=w;poz=-1;
for (i=0;i<a[x].size()&&ok;i++)
{
if (a[x][i]==fx) poz=i,ok=0;
}
return !ok;
}
int main()
{
ifstream f("hashuri.in");
ofstream g("hashuri.out");
unsigned int n,i,op,x;
f>>n;
for (i=1;i<=n;i++)
{
f>>op>>x;
if (op==3) g<<findh(x)<<'\n';
else
{
if (findh(x))
{
if (op==2) a[x%w].erase(a[x%w].begin()+poz);
}
else
{
if (op==1) a[x%w].push_back(x);
}
}
}
f.close();
g.close();
return 0;
}