Pagini recente » Cod sursa (job #738171) | Cod sursa (job #1432724) | Cod sursa (job #415365) | Cod sursa (job #395778) | Cod sursa (job #2356942)
#include <bits/stdc++.h>
#define MOD 666013
using namespace std;
ifstream in ("hashuri.in") ;
ofstream out ("hashuri.out");
vector < int > v [ MOD ] ;
vector < int > :: iterator find_value ( int x )
{
vector < int > :: iterator it ;
for ( it = v[ x % MOD ].begin() ; it != v [ x % MOD ].end() ; ++ it )
if ( *it == x ) return it ;
return v [ x % MOD ].end() ;
}
void push_x ( int x )
{
vector < int > :: iterator it ;
if ( find_value(x) == v[ x % MOD ].end() )
v [ x % MOD ].push_back(x) ;
}
void erase_value ( int x )
{
vector < int > :: iterator it ;
it = find_value ( x ) ;
if ( it != v [ x % MOD ].end() )
v [ x % MOD ].erase (it) ;
}
int n , x , y ;
int main ()
{
in >> n ;
while ( n -- )
{
int x ;
in >> x >> y ;
if ( x == 1 ) push_x( y ) ;
if ( x == 2 ) erase_value ( y ) ;
if ( x == 3 ) if ( find_value( y ) == v [ y % MOD ].end() ) out << "0\n" ;
else out << "1\n" ;
}
}