Cod sursa(job #2077836)

Utilizator MarinPeptenaruMarin Vasile Peptenaru MarinPeptenaru Data 28 noiembrie 2017 17:49:23
Problema Hashuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.64 kb
#include <bits/stdc++.h>

using namespace std;
ifstream in("hashuri.in");
ofstream out("hashuri.out");
const int mod=666013;
vector < int > h[mod];
int n,op,x;
int main()
{
    for(in>>n;n;n--)
    {
        in>>op>>x;
        int k=x%mod;
        switch (op)
        {
            case 1:
            h[k].push_back(x);
            break;
            case 2:
            if(find(h[k].begin(),h[k].end(),x)!=h[k].end())
                h[k].erase(find(h[k].begin(),h[k].end(),x));
            break;
            case 3:
            out<<(find(h[k].begin(),h[k].end(),x)!=h[k].end())<<'\n';
        }
    }
    return 0;
}