Pagini recente » Cod sursa (job #2525280) | Cod sursa (job #2668422) | Cod sursa (job #180476) | Cod sursa (job #291810) | Cod sursa (job #2088309)
#include <bits/stdc++.h>
using namespace std;
ifstream fin ("hashuri.in") ;
ofstream fout("hashuri.out") ;
vector<int> t[666014] ;
int main()
{
int n , i , x , tp , y , j;
bool rez ;
fin >> n ;
for ( int i = 1 ; i <= n ; i++ )
{
fin >> tp >> x ;
rez = false ;
if ( tp == 1 )
{
y = x % 666013 ;
for ( j = 0 ; j < t[y].size() ; j++ )
if ( t[y][j] == x )
rez = true ;
if ( rez == false )
t[y].push_back(x) ;
}
else if ( tp == 2 )
{
y = x % 666013 ;
for ( j = 0 ; j < t[y].size() ; j++ )
if ( x == t[y][j] )
t[y].erase(t[y].begin()+j,t[y].begin()+j+1) ;
}
else if ( tp == 3 )
{
y = x % 666013 ;
for ( j = 0 ; j < t[y].size() ; j++ )
if ( t[y][j] == x )
rez = true ;
if ( rez == true )
fout <<"1" << '\n' ;
else
fout <<"0" << '\n' ;
}
}
}