Pagini recente » Cod sursa (job #2179196) | Cod sursa (job #2429339) | Cod sursa (job #2117488) | Cod sursa (job #162072) | Cod sursa (job #1568165)
# include <fstream>
# include <algorithm>
# include <unordered_map>
# define endl "\n"
using namespace std;
ifstream f ( "hashuri.in" );
ofstream g ( "hashuri.out" );
unordered_map < int, int > Hash;
void inserare ( int x )
{
Hash[x] ++;
}
void stergere ( int x )
{
Hash.erase( x );
}
bool cautare ( int x )
{
if ( Hash.find(x) != Hash.end() )
return 1;
return 0;
}
int main ()
{
int n, x, optiune;
f >> n;
for ( int i = 1; i <= n; i ++ )
{
f >> optiune >> x;
if ( optiune == 1 )
inserare ( x );
else
if ( optiune == 2 )
stergere ( x );
else
g << cautare ( x ) << endl;
}
return 0;
}