Cod sursa(job #2123218)
| Utilizator | Data | 5 februarie 2018 22:09:22 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.54 kb |
#include <bits/stdc++.h>
using namespace std;
unordered_map < int, int > mp;
int main()
{
ios::sync_with_stdio(0); cin.tie(0);
ifstream in("hashuri.in");
ofstream out("hashuri.out");
int key = 1, el, n,qw;
in >> n ;
for(int i=1; i<=n; i++)
{
in >> qw >> el;
if( qw == 1 && mp.find(el) == mp.end() ) mp[el] = key;
if( qw == 2 ) mp.erase(el);
if( qw == 3 ) if( mp.find(el) != mp.end() ) out <<1 << '\n'; else out << 0 << '\n';
key ++;
}
return 0;
}
