Pagini recente » Cod sursa (job #87197) | Cod sursa (job #513951) | Cod sursa (job #62728) | Cod sursa (job #2877036) | Cod sursa (job #1048111)
#include <iostream>
#include <fstream>
#include <map>
using namespace std;
int main()
{
map<int, int>operatie;
ifstream citire;
citire.open("hasuri.in");
ofstream scriere;
scriere.open("hasuri.out");
int n, op, x;
citire >> n;
for (int i = 0; i < n; i++)
{
citire >> op >> x;
switch (op)
{
case 1:
if (operatie.find(x) == operatie.end())operatie[x] = x;
break;
case 2:
if (operatie.find(x) != operatie.end())operatie.erase(x);
break;
case 3:
if (operatie.find(x) != operatie.end())scriere << "1\n";
else scriere << "0\n";
break;
}
}
citire.close();
scriere.close();
return 0;
}