Cod sursa(job #1964368)
Utilizator | Data | 13 aprilie 2017 13:13:47 | |
---|---|---|---|
Problema | Hashuri | Scor | 70 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.39 kb |
#include <fstream>
#include <map>
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
int N, NR;
map <int, int> M;
int main()
{ int i, tip, x;
f>>N;
for (i=1;i<=N;i++)
{ f>>tip>>x;
if (tip == 1 and M.find(x)==M.end()) M[x]=++NR;
if (tip == 2) M.erase(x);
if (tip == 3) g<<(M.find(x)!=M.end())<<'\n';
}
return 0;
}