Cod sursa(job #3230321)

Utilizator Ruxandra009Ruxandra Vasilescu Ruxandra009 Data 20 mai 2024 15:44:32
Problema Hashuri Scor 30
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.45 kb
#include <fstream>
#include <map>

using namespace std;

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

const int mod = 666013;
int n;
map<int, int> a;

int main()
{
    f >> n;
    for(int i = 1; i <= n; i ++)
    {
        int op, x; f >> op >> x;

        if(op == 1)
            a[x % mod] ++;

        else if(op == 2 && a[x % mod])
            a[x % mod] --;

        else if(op == 3)
            g << (a[x % mod] > 0) << '\n';
    }
    return 0;
}