Cod sursa(job #2174801)

Utilizator albucristianAlbu Cristian-Gabriel albucristian Data 16 martie 2018 13:32:41
Problema Hashuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.77 kb
#include <fstream>
#include <vector>
using namespace std;
vector <int> viz[666013];
int main()
{
    int n,op,x;
    ifstream in("hashuri.in");
    ofstream out("hashuri.out");
    in>>n;
    for(int i=1;i<=n;i++)
    {
        in>>op>>x;
        if(op==1)
            viz[x%666013].push_back(x);
        if(op==2)
        {
            for(int j=0;j<viz[x%666013].size();j++)
            {
                if(viz[x%666013][j]==x)
                    viz[x%666013][j]=0;
            }
        }
        if(op==3)
        {
            int ok=0;
            for(int j=0;j<viz[x%666013].size();j++)
            {
                if(viz[x%666013][j]==x)
                    ok=1;
            }
            out<<ok<<"\n";
        }
    }
    return 0;
}