Cod sursa(job #2193016)
Utilizator | Data | 8 aprilie 2018 13:25:45 | |
---|---|---|---|
Problema | Hashuri | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 1.09 kb |
#include <bits/stdc++.h>
#define rest 666013
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
vector<int>h[666015];
int n,c,x;
int main()
{
fin>>n;
for(int i=1;i<=n;i++)
{
fin>>c>>x;
if(c==1)
{
bool k=0;
for(int j=0;j<h[x%rest].size();j++)
if(h[x%rest][j]==x)
{
k=1;
break;
}
if(!k)
h[x%rest].push_back(x);
continue;
}
if(c==2)
{
for(int j=0;j<h[x%rest].size();j++)
if(h[x%rest][j]==x)
{
h[x%rest].erase(h[x%rest].begin()+j);
break;
}
continue;
}
if(c==3)
{
bool k=0;
for(int j=0;j<h[x%rest].size();j++)
if(h[x%rest][j]==x)
{
k=1;
break;
}
fout<<k<<"\n";
}
}
return 0;
}