Pagini recente » Cod sursa (job #2099455) | Cod sursa (job #730729) | Cod sursa (job #43553) | Cod sursa (job #1808300) | Cod sursa (job #2910054)
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
ifstream fin ( "hashuri.in" );
ofstream fout ( "hashuri.out" );
const int E = 168323;
vector <int> h[E];
int main () {
int n, i, c, x;
fin >> n;
for ( i = 0; i < n; i++ ){
fin >> c >> x;
if ( c == 1 ){
int i1 = 0;
while ( i1 < h[x % E].size() && h[x % E][i1] != x )
i1++;
if ( i1 == h[x % E].size() )
h[x % E].push_back(x);
}
if ( c == 2 ){
int i1 = 0;
while ( i1 < h[x % E].size() && h[x % E][i1] != x )
i1++;
if ( i1 != h[x % E].size() ) {
swap(h[x % E][i1], h[x % E].back());
h[x % E].pop_back();
}
}
if ( c == 3 ){
int i1 = 0;
while ( i1 < h[x % E].size() && h[x % E][i1] != x )
i1++;
if ( i1 != h[x % E].size() )
fout << "1\n";
else
fout << "0\n";
}
}
return 0;
}