Cod sursa(job #2609573)

Utilizator AlexVulpoiuAlexandru Vulpoiu AlexVulpoiu Data 2 mai 2020 22:20:07
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.71 kb
#include <fstream>
#include <set>

using namespace std;

ifstream f("hashuri.in");
ofstream g("hashuri.out");

int n, op, x;
set<int> H[666015];

int main()
{
    f >> n;
    while(n)
    {
        f >> op >> x;

        switch(op)
        {
            case 1:
                H[x % 666013].insert(x);
                break;
            case 2:
                H[x % 666013].erase(x);
                break;
            case 3:
                if(H[x % 666013].find(x) != H[x % 666013].end())
                    g << "1\n";
                else
                    g << "0\n";
                break;
        }

        n--;
    }

    f.close();
    g.close();

    return 0;
}