Cod sursa(job #633037)

Utilizator IoanaMarMarussi Ioana IoanaMar Data 12 noiembrie 2011 20:17:49
Problema Hashuri Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.64 kb
#include <fstream>
#include <cstdio>
#include <vector>
using namespace std;
vector <int> v[666018];

 int main()
{
fstream f("hashuri.in");
fstream 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;
}