Cod sursa(job #2200503)

Utilizator mlc_oficialBoris Barca mlc_oficial Data 1 mai 2018 17:07:28
Problema Hashuri Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.98 kb
#include <bits/stdc++.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
 
typedef __gnu_pbds::cc_hash_table<int, __gnu_pbds::null_type> UnorderedSet;

int in;

struct _io{
	char*s;
	_io():s((char*)mmap(0,1<<28,PROT_READ,MAP_PRIVATE,fileno(stdin),0)){}
	operator int(){
		int x=0;
		while(*s<48)s++;
		while(*s>32)x=x*10+*s++-48;
		return x;
	}
}it;

int main() {
#ifdef INFOARENA
    in = open("hashuri.in", O_RDONLY);
    freopen("hashuri.out", "w", stdout);
#else
    in = open("input.txt", O_RDONLY);
#endif

    UnorderedSet s;
    int num_queries = it;
     
    while (num_queries--) {
        int query_type = it, el = it;
        if (query_type == 1) {
            s.insert(el);
        } else if (query_type == 2) {
            s.erase(el);
        } else {
            putchar((s.find(el) != s.end()) + '0');
            putchar('\n');
        }
    }
 
    return 0;
}