Cod sursa(job #2497670)

Utilizator poparobertpoparobert poparobert Data 23 noiembrie 2019 09:58:32
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.87 kb
#include <fstream>
#include <vector>
#define mod 100003
using namespace std;
ifstream cin("hashuri.in");
ofstream cout("hashuri.out");
int n,c,x,y;
vector<int> f[100005];
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>c>>x;
        if(c==1)
        f[x%mod].push_back(x);
        else if(c==2)
        {
            y=x%mod;
            for(int j=0;j<f[y].size();j++)
            {
                if(f[y][j]==x)
                    f[y][j]=0;
            }
        }
        else
        {
            y=x%mod;
            for(int j=0;j<f[y].size();j++)
            {
                if(f[y][j]==x)
                {
                    cout<<1<<'\n';
                    y=-1;
                    break;
                }
            }
            if(y>-1)
                cout<<0<<'\n';
        }
    }
    return 0;
}