Cod sursa(job #2196500)

Utilizator bebeetarepredescu bebeetare Data 19 aprilie 2018 16:12:33
Problema Hashuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.69 kb
#include <bits/stdc++.h>
#define eu 666013

using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
vector <int > a[eu];
int n,i,cer,x,j,nr;
int main()
{
    f>>n;
    for(i=1;i<=n;i++)
    {
        f>>cer>>x;
        if(cer==1)
        {
            a[x%eu].push_back(x);
        }
        else if(cer==2)
        {
            for(j=0;j<a[x%eu].size();j++)
            {
                if(a[x%eu][j]==x)a[x%eu][j]=-1;
            }
        }
        else
        {
            nr=0;
            for(j=0;j<a[x%eu].size();j++)
            {
                if(a[x%eu][j]==x)nr=1;
            }
            g<<nr<<'\n';
        }
    }
    return 0;
}