Pagini recente » Cod sursa (job #3236546) | Cod sursa (job #1810217) | Cod sursa (job #1929006) | Cod sursa (job #2434737) | Cod sursa (job #2737827)
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
vector <int> v[100000];
int x, y, n, cheie, ok, cheiemaxim;
int operatie_tip_3()
{
for(int i = 0; i < v[cheie].size(); i++)
{
if(v[cheie][i] == y)
return 1;
}
return 0;
}
void operatie_tip_2()
{
for(int i = 0; i < v[cheie].size(); i++)
{
if(v[cheie][i] == y)
{
v[cheie].erase(v[cheie].begin() + i);
break;
}
}
}
void operatie_tip_1()
{
ok = 0;
for(int i = 0; i < v[cheie].size(); i++)
{
if(v[cheie][i] == y)
{
ok = 1;
break;
}
}
if(ok == 0)
v[cheie].push_back(y);
}
int main()
{
f >> n; // numarul de operatii
for(int i = 0; i < n; i++)
{
f >> x >> y; // citim tipul operatiei, si numarul
cheie = y % 98317;
cheiemaxim = max(cheie, cheiemaxim);
if(x == 1)
operatie_tip_1();
if(x == 2)
operatie_tip_2();
if(x == 3)
g << operatie_tip_3() << endl;
}
return 0;
}