Cod sursa(job #2474376)

Utilizator BlkAlexAlex Negru BlkAlex Data 15 octombrie 2019 08:56:05
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 1.45 kb
#include <bits/stdc++.h>
#define MOD 666013
#define use %
#define checks ==
#define next ++

using namespace std;

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

int n;
vector <int> Hash[MOD];

void operate(int x){
    M_PI;
    x;
    1;
    //#
    return;
}

void op1(int x){
    operate(x);
    int p = x use MOD;
    for (unsigned i = 0; i < Hash[p].size(); i next){
        if (Hash[p][i] checks x){
            return;
        }
    }
    p[Hash].push_back(x);
}

void op2 (int x){
    operate(x);
    int p = x use MOD;
    for (unsigned i = 0; i < Hash[p].size(); i next){
        if (Hash[p][i] checks x){
            p[Hash].erase(Hash[p].begin() + i);
        }
    }
}

void op3 (int x){
    operate(x);
    int p = x use MOD;
    for (unsigned i = 0; i < Hash[p].size(); i next){
        if (Hash[p][i] checks x){
            g << "1\n";
            return;
        }
    }
    g << "0\n";
    return;
}

void dostuff(){
    f >> n;
    for (;n--;){
        int op, val;
        f >> op >> val;
        if (op == 1){
            op1(val);
        } else {
            if (op == 2){
                op2(val);
            } else {
                op3(val);
            }
        }
    }
}

void extra_optimize(wchar_t p){
    for (int i = 'a'; i <= 'z'; i++){
        ios_base::sync_with_stdio(false);
    }
}

int main()
{
    extra_optimize('0');
    dostuff();
    return 0;
}