Pagini recente » Cod sursa (job #91667) | Cod sursa (job #2710441) | Cod sursa (job #2464121) | Cod sursa (job #3157770) | Cod sursa (job #3255338)
#include <fstream>
#include <algorithm>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
const int dim = 1000000 + 5;
struct ura
{
int tip, x, ind;
}q[dim + 5];
bool cmp( ura a, ura b )
{
return a.x < b.x;
}
bool cmp2(ura a, ura b )
{
return a.ind < b.ind;
}
bool f[dim + 5];
int main()
{
int n, i, j;
fin >> n;
for ( i = 1; i <= n; ++i )
{
fin >> q[i].tip >> q[i].x;
q[i].ind = i;
}
sort( q + 1, q + n + 1, cmp);
int nr = 1;
for ( i = 1; i < n; ++i )
{
int cop = q[i].x;
q[i].x = nr;
if ( q[i + 1].x != cop )
++nr;
}
q[n].x = nr;
sort(q + 1, q + n + 1, cmp2 );
for ( i = 1; i <= n; ++i )
{
// fout << q[i].tip << " " << q[i].x << endl;
if ( q[i].tip == 1 )
f[q[i].x] = 1;
if ( q[i].tip == 2 )
f[q[i].x] = 0;
if ( q[i].tip == 3 )
fout << f[q[i].x] << '\n';
}
return 0;
}