Cod sursa(job #2911655)

Utilizator BlaugranasEnal Gemaledin Blaugranas Data 1 iulie 2022 05:23:59
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.48 kb
#include<bits/stdc++.h>
using namespace std;
ifstream A("hashuri.in");
ofstream B("hashuri.out");
#define M 666013
int n,o,x,y;
set<int> G[M];
int main()
{
    for(A>>n;n;--n) {
        A>>o>>x,y=x%M;
        auto r=G[y].find(x);
        if(o==1) {
            if(r==G[y].end())
                G[y].insert(x);
        } else if(o==2) {
            if(r!=G[y].end())
                G[y].erase(r);
        } else
            B<<(r!=G[y].end())<<'\n';
    }
    return 0;
}