Cod sursa(job #633233)
| Utilizator | Data | 13 noiembrie 2011 12:22:02 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 70 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.65 kb |
#include <fstream>
#include <cstdio>
#include <vector>
using namespace std;
vector <int> v[666018];
int main()
{
ifstream f("hashuri.in");
ofstream g("hashuri.out");
int n, op, x, c, ok, i;
f>>n;
vector <int> :: iterator it;
while (n--)
{
f>>op>>x;
c=x%666013;
if (op==1)
v[c].push_back(x);
else
{
ok=0;
for (it=v[c].begin(); it!=v[c].end(); it++)
if (*it==x)
{
ok=1;
if (op==2)
v[c].erase(it);
break;
}
if (op==3)
g<<ok<<"\n";
}
}
return 0;
}
