Pagini recente » Cod sursa (job #1100035) | Cod sursa (job #3190271) | Cod sursa (job #2205340) | Cod sursa (job #2954600) | Cod sursa (job #1954574)
#include<fstream>
#include<vector>
#include<algorithm>
using namespace std;
ifstream in("hashuri.in");
ofstream out("hashuri.out");
vector<int> v[100009];
int n,i,op,x,z,ok,j,a;
int main(){
in >> n;
for( i = 1; i <= n; i ++ ){
in >> op >> x;
z = x % 100009;
if( op == 1){
ok = 0;
for( j = 0; j < v[z].size(); j ++ ) {
if( v[z][j] == x ){
ok = 1;
}
}
if( ok == 0 ){
v[z].push_back(x);
}
}
if( op == 2 ){
ok = 0;
for( j = 0; j < v[z].size(); j ++ ) {
if( v[z][j] == x ){
ok = 1;
a = j;
}
}
if( ok == 1 ){
swap( v[z][a] , v[z][v[z].size()-1]);
v[z].pop_back();
}
}
if( op == 3 ){
ok = 0;
for( j = 0; j < v[z].size(); j ++ ) {
if( v[z][j] == x ){
ok = 1;
}
}
out << ok << "\n";
}
}
return 0;
}