Cod sursa(job #2276678)
| Utilizator | Data | 5 noiembrie 2018 09:54:47 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 60 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.54 kb |
#include <stdio.h>
#include <map>
#include <fstream>
using namespace std;
int N, NR;
map <int, int> M;
int main()
{
ifstream input("hashuri.in");
ofstream output("hashuri.out");
int i, tip, x;
input >> N;
for (i = 1; i <= N; i++)
{
input >> tip >> x;
switch(tip){
case 1:
if(M.find(x)==M.end())
M[x]=++NR;
break;
case 2:
M.erase(x);
break;
case 3:
if(M.find(x) != M.end())
output << "1" << endl;
else
output << "0" << endl;
}
}
return 0;
}