Pagini recente » Atasamentele paginii Clasament amb3r_heard | Monitorul de evaluare | Istoria paginii blog/loturi-online | Profil Varzucile_Vesele | Cod sursa (job #531036)
Cod sursa(job #531036)
// hash.cpp
//
// Copyright 2010 SpeeDemon <virtualdemon@ubuntu>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
// MA 02110-1301, USA.
#include <hash_set.h>
#include <cstdio>
#define dim 30
using namespace std;
using namespace __gnu_cxx;
hash_set< int, hash<int> > v;
char ax[dim];
int pz;
inline void cit(int &x)
{
x=0;
while(ax[pz]<'0' || ax[pz]>'9')
if(++pz==dim)fread(ax,1,dim,stdin),pz=0;
while(ax[pz]>='0' && ax[pz]<='9')
{
x=x*10+ax[pz]-'0';
if(++pz==dim)fread(ax,1,dim,stdin),pz=0;
}
}
int main()
{int n, x, y;
freopen("hashuri.in","r",stdin);
freopen("hashuri.out","w",stdout);
cit(n);
for( ; n; --n )
{
cit(x);cit(y);
switch( x )
{
case 1: v.insert(y); break;
case 2: v.erase(y); break;
case 3: printf("%d\n", v.end() != v.find(y)); break;
}
}
return 0;
}