Pagini recente » Cod sursa (job #3168051) | Cod sursa (job #1002356) | Cod sursa (job #2037814) | 058855 | Cod sursa (job #2378769)
#include <fstream>
#include <set>
#define MOD 666013
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
multiset <int> v[MOD];
multiset <int>::iterator it;
int n, i, op, x, pos;
int main()
{
f >> n;
for(i=1; i<=n; i++){
f >> op >> x;
pos = x % 666013;
it = v[pos].lower_bound(x);
if(op==1 && (*it) != x)
v[pos].insert(x);
if(op==2 && (*it) == x)
v[pos].erase(x);
if(op==3){
if( (*it) == x) g << "1\n";
else g << "0\n";
}
}
return 0;
}