Pagini recente » Cod sursa (job #1488270) | Cod sursa (job #2385399) | Cod sursa (job #2084106) | Cod sursa (job #2666872) | Cod sursa (job #2892206)
#include <iostream>
#include <fstream>
#include <bits/stdc++.h>
#define mod 666013
using namespace std;
ifstream in("hashuri.in");
ofstream out("hashuri.out");
//matrice(indice linie=cheie)
vector <int>m[mod+1];
int n, cerinta;
long long x;
int main()
{
in>>n;
for(int i=0; i<n; i++)
{
in>>cerinta>>x;
int l=m[x%mod].size();
if(cerinta==1)
{
bool gasit=0;
for(int j=0; j<l; j++)
if(m[x%mod][j]==x)
gasit=1;
if(gasit==0)
m[x%mod].push_back(x);
}
if(cerinta==2)
{
for(int j=0; j<l; j++)
if(m[x%mod][j]==x)
{
int aux=m[x%mod][j];
m[x%mod][j]=m[x%mod][l-1];
m[x%mod][l-1]=aux;
m[x%mod].pop_back();
}
}
if(cerinta==3)
{
bool gasit=0;
for(int j=0; j<l; j++)
if(m[x%mod][j]==x)
{
gasit=1;
out<<1<<endl;
}
if(gasit==0)
out<<0<<endl;
}
}
return 0;
}