Cod sursa(job #2594258)

Utilizator Katherine456719Swan Katherine Katherine456719 Data 5 aprilie 2020 17:09:19
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.68 kb
#include <iostream>
#include <fstream>
#include <set>
using namespace std;
const int m=100005;
set<long long> v[m];
int main()
{
    ifstream cin("hashuri.in");
    ofstream cout("hashuri.out");
    int t;
    cin>>t;
    for(int i=1; i<=t; i++)
    {
        int x;
        long long y;
        cin>>x>>y;
        if(x==1)
            v[y%m].insert(y);
        else if(x==2)
        {
            if(v[y%m].find(y)!=v[y%m].end())
                v[y%m].erase(y);
        }
        else if(x==3)
        {
            if(v[y%m].find(y)!=v[y%m].end())
                cout<<1<<"\n";
            else
                cout<<0<<"\n";
        }
    }
    return 0;
}