Cod sursa(job #1982547)
| Utilizator | Data | 19 mai 2017 12:32:38 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.56 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
unordered_map <int, int>a;
int n, Nr, x;
void Rezolva(int tip, int x)
{
if(tip == 1)
if(a.find(x) == a.end())
a[x] = Nr;
if(tip == 2)
a.erase(x);
if(tip == 3)
fout << (a.find(x) != a.end()) << "\n";
}
void Citire()
{
int i, tip;
fin >> n;
for(i = 1; i <= n; i++)
{
fin >> tip >> x;
Rezolva(tip, x);
}
}
int main()
{
Citire();
return 0;
}
