Cod sursa(job #1564633)
Utilizator | Data | 9 ianuarie 2016 20:17:35 | |
---|---|---|---|
Problema | Hashuri | Scor | 70 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.53 kb |
#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
long long n,i,op,x;
unordered_map <int,int> m;
int main()
{
ifstream f("hashuri.in");
ofstream g("hashuri.out");
f>>n;
for (i=1;i<=n;++i) {
f>>op>>x;
if (op==1 &&m[x]!=1) ++m[x];
if (op==2) m.erase(x);
if (op==3) {
if (m.find(x)==m.end()) g<<"0\n";
else
g<<"1\n";
}
}
f.close();
g.close();
return 0;
}