Cod sursa(job #631610)

Utilizator IoanaMarMarussi Ioana IoanaMar Data 8 noiembrie 2011 21:03:30
Problema Hashuri Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.8 kb
#include <iostream>
#include <fstream>
#include <vector>

using namespace std;

ifstream f("hashuri.in");
ofstream g("hashuri.out");

vector <int> v[666018];


int main()
{
    int n,i,op,x,c,ok;

    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;
}