Cod sursa(job #2108469)

Utilizator VoineaAndreiVoinea Ioan-Andrei VoineaAndrei Data 18 ianuarie 2018 13:25:49
Problema Hashuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.58 kb
#include<bits/stdc++.h>
using namespace std;

#define default_modulo 666013

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

map <int, int>dict[default_modulo + 2];
int  q, x;

int main(){

    int n;
    f>>n;

    int q,x;
    while(n>0){
    f>>q>>x;

    if(q==1) dict[x%default_modulo][x]=1;
    else if(q==2){
        if(dict[x%default_modulo].count(x))
        dict[x%default_modulo].erase(x);
    }
    else if(q==3){
        if (dict[x%default_modulo].count(x))
            g<<"1\n";
        else
            g<<"0\n";
    }
    --n;
  }

}